Have you ever come across this problem? You want to update a keyfield in a file that contains multiple keyfields....
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
It is quiet easy until the SQL-statement won't result in a duplicate key error. Here's the statement to bypass:
Update Filename f1 set Keyvalue2 = Keyvalue2 + 1 where 0 = (Select count(*) from filename f2 where f2.Keyvalue1 = f1.Keyvalue1 and f2.Keyvalue2 = f1.Keyvalue1+1)
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.