Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Constraint Violating Yak Guru

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.

Patron Saint of Lost Yaks

30421 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

Flowing Fount of Yak Knowledge

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  
 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.02 seconds. Powered By: Snitz Forums 2000