Banu Sharma
Banu Sharma

Reputation: 23

Incorrect syntax near the keyword 'DEFAULT' in SQL Server

I prepared below script to drop default value column.

ALTER TABLE [TableName] 
ALTER COLUMN [ColumnName] DROP DEFAULT;

But It has following error

Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword 'DEFAULT'.

Upvotes: 2

Views: 3618

Answers (1)

TT.
TT.

Reputation: 16144

Look up the name of the default constraint, and drop the constraint by name:

ALTER TABLE [table_name] DROP CONSTRAINT [constraint_name];

Upvotes: 1

Related Questions