Tuesday, June 28, 2011

A column may have null values. But I want to ensure that all not null values are UNIQUE.



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

How to check local and global angular versions

 Use the command ng version (or ng v ) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to f...