By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,843 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,843 IT Pros & Developers. It's quick & easy.

Violation of Unique Key contraint during update

P: 2
I'm using a Unique Key constraint for the first time, and I think I may not be understanding something correctly. I have a table with a Primary key (media_format_id) that is auto-increment. Then I have 3 fields which are Foreign Keys, that I also added a Unique constraint to. I do not want any 2 records with the same value combination for those three fields (media_id, format_id, lang_id).

Here is the sp_help for my table (view attached image):
nonclustered, unique, unique key located on PRIMARY media_id, format_id, lang_id

clustered, unique, primary key located on PRIMARY media_format_id

I use a stored procedure to create the records, and another to update them. Create works fine (unique constraint and all), but during update, I get the Violation of Unique Key contraint error every time.

Can anyone point me in the right direction ? Thank you
Attached Images
File Type: jpg sp_help.jpg (71.3 KB, 272 views)
Sep 18 '09 #1
Share this Question
Share on Google+
1 Reply

P: 2
I found the problem. It was in the update stored procedure. My where clause syntax had an error.
Sep 18 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.