Unique-constraint is an index that sets one or multiple fields to be unique in a data entity
Questions tagged [unique-constraint]
1353 questions
-2
votes
1 answer
SSMS Showing diff error message in 2008 and 2014 on Violation of UNIQUE KEY constraint
While inserting a record to my table table1 in SQL Server 2008 instance, I'm getting the following error
Msg 2627, Level 14, State 1, Line 1
Violation of UNIQUE KEY constraint 'IX_table1'. Cannot insert duplicate key in object 'dbo.table1'.
But…

Abdul Rasheed
- 6,486
- 4
- 32
- 48
-2
votes
2 answers
Unique constraint (SchemaName.DATA1_PK)
I am inserting data into a table by selecting from CURSOR but I am getting a unique constraint violation.
Here is the query:
CURSOR cRestParmRestData(nSetId in number) IS
SELECT distinct rstdata.rest_id,
rstdata.rest_inst_id,
…

Jatin Gupta
- 33
- 1
- 10
-2
votes
2 answers
How to query the look up table for unique values?
I have a recipe table that is structured like this:
product2recipe
id | productid | recipeid
I want to eliminate insertion of duplicate values. Basically a recipe can contain 1 or more productid. So it looks like this:
1 | 1 | 1
2 | 2 | 1
3 | 1 |…

samuelmrrsn
- 3
- 2