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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-11 : 00:41:11
|
| Phil writes "I have a table that contains an optional field which, if specified, must be unique and which is also used as an index into the table. In previous databases I have worked with this was simply defined as a unique secondary key "ignoring nulls".Is there any way of doing this in SQL Server 7 (or 2000)? The closest I can find in the documentation is the UNIQUE CONSTRAINT which allows one record to contain a null value (which seems pretty pointless) but nothing that will ignore multiple null values and enforce uniqueness on non-null values.Obviously I can achieve a similar effect with a trigger, but would prefer to avoid that if possible." |
|
|
|
|
|