Click here to Skip to main content
16,012,116 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi ,

I want to know what is the use of allowing only one null value in Unique Key column.


thanks.
Posted

1 solution

Logically, any key which is allowed to contain non duplicate (unique) values is a unique key, NULL is a permissible value in sql server , so it can have NULL for a single time just like any other value.

But as per standards, there is no such rule that only ONE NULL is allowed based on standards.
Refer:
http://en.wikipedia.org/wiki/Unique_key[^]
http://connect.microsoft.com/SQLServer/feedback/details/299229/change-unique-constraint-to-allow-multiple-null-values[^]
 
Share this answer
 
Comments
fjdiewornncalwe 19-Oct-12 14:42pm    
+5. Excellent.
As an additional note. The one NULL value will only be valid if the column allows NULLs, so this UNIQUE constraint is somewhat tied to that property as well.
Sandeep Mewara 20-Oct-12 0:45am    
Thanks. And yes, your additional comments are to be kept in mind.
Sergey Alexandrovich Kryukov 19-Oct-12 15:26pm    
5ed.
--SA
Sandeep Mewara 20-Oct-12 0:45am    
Thanks SA.
Maciej Los 21-Oct-12 5:48am    
Good answer, +5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900