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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Unique Key

Author  Topic 

udham1985
Starting Member

6 Posts

Posted - 2011-01-11 : 05:10:34
Hello I need to create unique key based on two column.

for example.

ID1 | ID2
205 | 365 allow to insert
205 | 454 allow to insert
454 | 365 allow to insert
205 | 365 not allow to insert (both values are inserted in one single row)

How can i Create Unique key based on my conditions. Is that possible to create the key.


Thanks
Udham

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-11 : 05:16:18
create a composite primary key for this table containing ID1 and ID2...
Go to Top of Page

udham1985
Starting Member

6 Posts

Posted - 2011-01-11 : 05:28:10
thank you, you solved my problem

quote:
Originally posted by MIK_2008

create a composite primary key for this table containing ID1 and ID2...

Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-11 : 05:36:55
you are welcome
Go to Top of Page
   

- Advertisement -