Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary key column alteration

Status
Not open for further replies.

Wollet

Programmer
Jan 12, 2006
2
IT
I need to ALTER a primary key COLUMN. I read the documentation and it isn't possible to alter. Does it exist a workaround for the problem?

Thank you
 
Can you be more specific on what you are trying to do?

Did you look at dropping a constraint?

Best Regards,
AA
 
I created a table with two column of varchar type. One of these is primary key. Now I need to ALTER the type of the two COLUMNs to nvarchar.
Only the non primary key column succeeds.

Thank you,
W88
 
Try the following:

Drop the primary key constraint.
Alter the data type of the column as desired.
Add the primary key constraint back.

Best Regards,
AA
 
Of course you should follow amitra's advice only when the database is not is use or you could have a problem with someone adding a duplicate record just while you are making the change. Always be aware fo the potential for Murphy's Law to kick in.

Questions about posting. See faq183-874
Click here to help with Hurricane Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top