How to create a UNIQUE Key on a Column which is having multiple NULL values?

0 votes
asked Nov 16, 2015 in T-SQL by Sunain (420 points)

1 Answer

0 votes
answered Nov 17, 2015 by user234 (980 points)

You Can drop first existing Unique key constraint

Alter Table YourTableName 
Drop Constraint Nameofuniquekeyconstraint

 after that create filter index.

CREATE UNIQUE NONCLUSTERED INDEX index_name
ON YourTableName (ColumnName ASC)
WHERE [ColumnName] IS NOT NULL;
 
Welcome to I Can Crack, where you can ask questions and receive answers from other members of the community.

68 questions

47 answers

3 comments

5,318 users

...