Solved

changing PK from into to bigint

Posted on 2010-09-10
3
223 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:anushahanna
3 Comments
 
LVL 16

Assisted Solution

by:vdr1620
vdr1620 earned 175 total points
Comment Utility
You will need to drop the Constraint, Alter the column using your statement above and then add the constraint back
0
 
LVL 13

Accepted Solution

by:
dwkor earned 325 total points
Comment Utility
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
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
that was a *very* helpful advice. Thanks experts.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now