A UNIQUE constraint is not useful here because, it will allow a single NULL value in the column, no DUPLICATE NULLs.
Use a filtered index here :
CREATE UNIQUE INDEX indexName ON tableName(columnNames) WHERE columnName IS NOT NULL
http://msdn.microsoft.com/en-us/library/cc280372.aspx
No comments:
Post a Comment