• I am sorry to say, looking at the correct answer, the question seems to be confusing! The question should have mentioned "Unique Index" instead of "Unique Constraint". Ideally, both Unique constraint and Unique index are same as Unique Constraint creates Unique Index to maintain the constraint to prevent duplicate keys. But eventually there are many differences and with the advent/introduction of Filtered Index, differences adds on...

    After reading the question, the first thing that came to my mind was to think of creating a unique constraint like below:

    ALTER TABLE Table_name

    ADD CONSTRAINT Constraint_name UNIQUE (Column_name)

    And this shall only allow one NULL value in the table!

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter