Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
GihanFdo
Starting Member
2 Posts |
Posted - 2009-01-06 : 02:47:38
|
| hi!i have created a table :CREATE TABLE customer(First_Name char(50),Last_Name char(50),Address char(50),City char(50),Country char(25));and alter a column like:alter table customer add reg_user bit default null;but now I need to drop that reg_user column by a script likealter table customerdrop column reg_user;but it gives a error:"Msg 5074, Level 16, State 1, Line 1The object 'DF__customer__reg_us__1ED998B2' is dependent on column 'reg_user'.Msg 4922, Level 16, State 9, Line 1ALTER TABLE DROP COLUMN reg_user failed because one or more objects access this column."can anyone help me with this?? thanks! |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-06 : 02:52:43
|
| first u have to drop the default constraint and then drop the column |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-06 : 02:54:56
|
| alter table tanggal drop constraint DF__customer__reg_us__1ED998B2alter table tanggal drop column reg_user |
 |
|
|
GihanFdo
Starting Member
2 Posts |
Posted - 2009-01-06 : 03:31:04
|
quote: Originally posted by GihanFdo hi!i have created a table :CREATE TABLE customer(First_Name char(50),Last_Name char(50),Address char(50),City char(50),Country char(25));and alter a column like:alter table customer add reg_user bit default null;but now I need to drop that reg_user column by a script likealter table customerdrop column reg_user;but it gives a error:"Msg 5074, Level 16, State 1, Line 1The object 'DF__customer__reg_us__1ED998B2' is dependent on column 'reg_user'.Msg 4922, Level 16, State 9, Line 1ALTER TABLE DROP COLUMN reg_user failed because one or more objects access this column."can anyone help me with this?? thanks!
thanks a lot it worked fine! |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-06 : 03:39:13
|
ur welcome |
 |
|
|
|
|
|
|
|