Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Howto: Provide Default value when ADDING COLUMN
Message
From
05/11/2008 10:45:52
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01359846
Message ID:
01359855
Views:
30
Hey Sergey,

Works like a charm! You are still and always will be "The Man" :)

Thanks for the super-quick reply - it's appreciated.

Best

-=Gary




>
>ALTER TABLE [dbo].[IndividualAttribsMeta] 
>	ADD [PlaysBridge] varchar(250) NOT NULL DEFAULT 'Plays Bridge'
>
>
>>Hi
>>
>>See the following T-SQL
>>
>>
>>ALTER TABLE [dbo].[IndividualAttribsMeta] 
>>	ADD [PlaysBridge] varchar(250) DEFAULT 'Plays Bridge'
>>
>>
>>What I would like to do is add the [PlaysBridge] column to the [dbo].[IndividualAttribsMeta] table and have the value 'Plays Bridge' inserted for this column in every row, within the same transaction covering the ALTER TABLE/ADD COLUMN action. When I run the above command, all I get is a Null as the column value. As far as "every row" is concerned, there will only ever be a single row in this table.
>>
>>After looking at SQL BOL, I get the feeling that this will not be possible but, if anyone has an idea, I would appreciate it.
>>
>>Thanks,
>>
>>-=G
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform