Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HowTo: DROP DEFAULT
Message
 
To
06/11/2008 10:49:51
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01360190
Message ID:
01360234
Views:
7
DEFAULT is constraint so you must drop constraint instead of DEFAULT:
ALTER TABLE [dbo].[IndividualAttribsMeta] 
      DROP CONSTRAINT [DF_PlaysBridge]

ALTER TABLE [dbo].[IndividualAttribsMeta] 
      DROP COLUMN [PlaysBridge]
But I am with Sergey, generate a script and see how MS did this :-)

>Hi
>
>Sergey gave me a great tip on how to specify a column default and avoid a null being applied, instead of my default.
>
>As this code develops, I know want to drop the column but the default that was created depends on the column, hence, the DROP COLUMN fails.
>
>In order to know the name of the default, I apply a user-defined DEFAULT name like so:-
>
>
>ALTER TABLE [dbo].[IndividualAttribsMeta] 
>   ADD [PlaysBridge] varchar(250) 
>   NOT NULL CONSTRAINT DF_PlaysBridge DEFAULT 'Plays Bridge' 
>
>
>This seems to work fine. However, when I try the following to delete the DEFAULT, SQL server complains:-
>
>
>ALTER TABLE [dbo].[IndividualAttribsMeta] 
>  DROP DEFAULT [dbo].[DF_PlaysBridge]
>  DROP COLUMN PlaysBridge
>
>Incorrect syntax near the keyword 'DEFAULT'.
>
>
>Can anyone see what is going wrong here?
>
>
>Thanks.
>
>-=Gary
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform