Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HowTo: DROP DEFAULT
Message
De
06/11/2008 11:51:06
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01360190
Message ID:
01360256
Vues:
7
Hi Sergey,
ALTER TABLE [dbo].[IndividualAttribsMeta] DROP CONSTRAINT [DF_PlaysBridge] 
ALTER TABLE [dbo].[IndividualAttribsMeta] DROP COLUMN PlaysBridge 
Nice :)

I tried all manner of things including DROP CONSTRAINT but, I only previously issued ALTER TABLE once!

Thanks for "teaching me how to fish" :)

Best regards,

-=Gary



>Gary,
>
>Delete column through EM but instead of saving changes generate a script and see what is involved.
>>
>>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
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform