Home > Uncategorized > Changing a default on a column on SQL

Changing a default on a column on SQL

If you set a default value to a column, then try to drop that column, in MS SQL, you sometimes get obscure errors like this.
 
Server: Msg 5074, Level 16, State 1, Line 1
The object ‘DF__question_v__type__50C5FA01’ is dependent on column ‘type’.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE DROP COLUMN type failed because one or more objects access this column.
I have found that this can be fixed with this command:
 
alter table question_values drop constraint DF__question_v__type__4FD1D5C8
 
Where the table name would be changed to fit your own purposes.
Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: