April 29, 2008 at 2:00 pm
Hi,
Is there any way to "cheat" on SQL on creating a unique index/constraint for the column that already has duplicates?
Let's say I do not care much that there are already some dups in the table (or even want to keep them) but at the same time I want to make sure it wont happen in the future?
Thanks!
April 29, 2008 at 2:15 pm
A index is either unique or it's not unique. To do what you want, you'll probably need a trigger, and it will hurt your insert/update performance.
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
April 29, 2008 at 2:22 pm
A partitioned table might allow you to do that, but not a regular table.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply