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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Unique on two column

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2002-11-07 : 08:26:43
I thought saw an article or post about either a trigger or constraint technique that would enforce unique rows based on a 2+ column key.

I can't find it now. Anyone recall something on this subject?

Help !

Sam

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-11-07 : 08:45:50
Sam, you can do this with a unique constraint ...

create table sam (
a char(1) not null,
b char(1) not null,
constraint u_sam unique (a,b) )

insert into sam select 'a','b'
insert into sam select 'a','b'



Mark-up SQLTeam posts here
http://www.markitup.com/Forum/SQLTeam.asp

Jay White
{0}
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2002-11-07 : 08:50:33
Nice use of markup. Sqlteam posts are kicking up a notch.

Thank you Jay ,

Sam

Go to Top of Page
   

- Advertisement -