Aren't the [brackets] just for when names have spaces or are keywords? Anyway, the syntax looks okay against that example... maybe try something like this: ALTER TABLE Contact_tbl MODIFY FirstName VARCHAR(50) DEFAULT 'dddddd' ?
On 8/30/07, Bruce, Rodney S Mr CTR USA AMC <[EMAIL PROTECTED]> wrote: > > Silly me I thought this would be a simple thing to do. > > I want to set defaults for some fields using a stored procedure. > My testing SP looks like: > ------------SP Code------------------------ > SET ANSI_NULLS ON > GO > SET QUOTED_IDENTIFIER ON > GO > > CREATE PROCEDURE SPTemp > > AS > BEGIN > > ALTER TABLE [dbo].[Contact_tbl] > ALTER COLUMN FirstName DEFAULT 'dddddd' > > > > END > GO > ---------------------------------------------- > I have tried veriations with and without [] around field name, with and > without SET > > These are the errors I am getting: > > > Msg 156, Level 15, State 1, Procedure SPTemp, Line 8 > Incorrect syntax near the keyword 'DEFAULT'. > > Using SET: > ALTER TABLE [dbo].[Contact_tbl] > ALTER COLUMN [FirstName] SET DEFAULT 'dddddd' > > Msg 156, Level 15, State 1, Procedure SPTemp, Line 8 > Incorrect syntax near the keyword 'SET'. > > Example from http://technet.microsoft.com/en-us/library/ms174123.aspx > ALTER TABLE MyCustomers ALTER COLUMN CompanyName SET DEFAULT 'A. Datum > Corporation' > > > Thanks for any help > Rodney > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Check out the new features and enhancements in the latest product release - download the "What's New PDF" now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2933 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6
