March 30, 2009 at 8:15 am
How would you enforce a unique key combination? For example, I have columns A and B in a table. I don't want A and B to be unique by themselves, but I want the combination of A and B in a single record to be unique. How would I do this? I've Googled for unique key combinations, but all I get are guides on setting up your basic unique keys, which isn't what I want. Does SQLServer support this?
Regards,
Chris
March 30, 2009 at 8:18 am
ALTER TABLE < Table name >
ADD CONSTRAINT < Constraint Name > UNIQUE (ColA, ColB)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 30, 2009 at 8:28 am
Thanks!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply