changing PK from into to bigint

when doing the above, i get the error

Msg 5074, Level 16, State 1, Line 2
The object 'PK_tblTracker' is dependent on column 'TrackerPK'.
Msg 4922, Level 16, State 9, Line 2
ALTER TABLE ALTER COLUMN TrackerPK failed because one or more objects access this column.

how would recommend working around this?

thanks
LVL 6
anushahannaAsked:
Who is Participating?
 
dwkorConnect With a Mentor Commented:
Keep in mind, it would be time consuming if you have a lot of data in the table. SQL Server will need to rebuild the table 3 times - one time when you drop PK constraint, second time when you change column time and last time when you recreate PK. In such case it could be simpler to create another table with correct structure, copy data to the new table, drop the old table and rename the new one.

If you don't want to do that, consider to disable all non-clustered indexes during the process.
0
 
vdr1620Connect With a Mentor Commented:
You will need to drop the Constraint, Alter the column using your statement above and then add the constraint back
0
 
anushahannaAuthor Commented:
that was a *very* helpful advice. Thanks experts.
0
All Courses

From novice to tech pro — start learning today.