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 |
|
daya_nirvana
Starting Member
3 Posts |
Posted - 2008-09-18 : 08:10:08
|
| I am trying to alter a column from my table usingALTER TABLE MM_MAT_TRANS_T ALTER COLUMN DOC_ITEM_NO NUMERIC(5,0)but when i do this i get the folloeing errorMsg 5074, Level 16, State 1, Line 1The object 'PK_MM_MAT_TRANS_T' is dependent on column 'doc_item_no'.Msg 4922, Level 16, State 9, Line 1ALTER TABLE ALTER COLUMN doc_item_no failed because one or more objects access this column.This is probably coz of the FK relation with other tables how to over come this issue-Daya |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-09-18 : 08:20:13
|
| drop the constraintalter both columnsre-add the constraintBe One with the OptimizerTG |
 |
|
|
daya_nirvana
Starting Member
3 Posts |
Posted - 2008-09-18 : 08:43:10
|
| Thanks I have already done that and its working. But is there an way to do it without dropping constraints.... |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-09-18 : 08:44:14
|
| No. You can disable constraints though. |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-09-18 : 09:21:08
|
| You can also add (or re-enable) them with NOCHECK. That would be a virually instantaneous action if you are concerned with the time it takes to re-apply them on large tables. Of course as the name implies it won't catch any value violations that may have been introduced when the constraint was inactive.Be One with the OptimizerTG |
 |
|
|
daya_nirvana
Starting Member
3 Posts |
Posted - 2008-09-18 : 09:40:53
|
| thanks |
 |
|
|
|
|
|