5
Answers

SQL Query - uniqueness in combination

Hi all,
 
I have a table as -
 ID Code Value
 1 101 abc
 2 101 def
 3 201 abc
 4 101 def
 
Now,
 
In this table, I need to check the uniqueness in combination -
101 - abc  ---> allowed.
101 - def ---> allowed.
101 - def ->> NOT ALLOWED.... Combination "101 - def" exists.
Similarly,
Combination "101 - abc" must not be allowed next time.
 
How to check this combination uniqueness in SQL Server ??
 
Please help !! 
 
 
Answers (5)