Solved

changing PK from into to bigint

Posted on 2010-09-10
3
229 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 175 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 325 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how the fundamental information of how to create a table.

730 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