Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

changing PK from into to bigint

Posted on 2010-09-10
3
Medium Priority
?
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Assisted Solution

by:vdr1620
vdr1620 earned 700 total points
ID: 33649077
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 1300 total points
ID: 33649165
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
ID: 33649219
that was a *very* helpful advice. Thanks experts.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

610 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