Solved

changing PK from into to bigint

Posted on 2010-09-10
3
225 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
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

932 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

10 Experts available now in Live!

Get 1:1 Help Now