SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Change PK data in row
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rookie_sql
Constraint Violating Yak Guru

Ireland
443 Posts

Posted - 09/25/2007 :  07:45:21  Show Profile  Reply with Quote
Hi i want to update a single column of data that is part of a PK is this possible to do, the only way i can see how to do it, it to remove the PK change the data and reset the PK, but i don't think this is the correct way of doing it.

SwePeso
Patron Saint of Lost Yaks

Sweden
30281 Posts

Posted - 09/25/2007 :  08:37:40  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Are there foreign keys associated to this PK? If so, enable CASCADE UPDATE before updating.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

blindman
Flowing Fount of Yak Knowledge

USA
2365 Posts

Posted - 09/25/2007 :  08:56:55  Show Profile  Reply with Quote
You can update data that is part of a primary key. If the column is defined as an IDENTITY column, you will need to issue SET IDENTITY INSERT ON before your update, and SET IDENTITY INSERT OFF immediately afterwards.

e4 d5 xd5 Nf6
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000