Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter Column

Status
Not open for further replies.

TomBarrand

Programmer
Aug 9, 2000
162
GB
I am trying to change the datatype of a column using the following syntax:

ALTER TABLE Purch_Ord_Line
ALTER COLUMN Items_Per_Container int
Go
I get the following error:

Server: Msg 5074, Level 16, State 1, Line 3
The object 'DF_Purch_Ord_Line_Items_Per_Container' is dependent on column 'Items_Per_Container'.
Server: Msg 4922, Level 16, State 1, Line 3
ALTER TABLE ALTER COLUMN Items_Per_Container failed because one or more objects access this column.

What does this mean?

Cheers
 
It appears that there is a DEFAULT constraint on the column you are attempting to ALTER. You'll need to drop the constraint before you can alter the column.

Use
Code:
sp_help Purch_Ord_Line
to determine what the default value is. After altering the column type, you can recreate the appropriate default constraint.

Good luck!

--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top