DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   
Stats
Total Count : 3
Resources Publish New Article  
 
Does UNIQUE KEY supports more than one NULL Value?
Ashok Nalam

No. In SQL server we can insert only one NULL value to column which has UNIQUE KEY constraint.

Example:

CREATE TABLE SamepleUnique
(
Id INT PRIMARY KEY,
Name varchar(20) UNIQUE
)
INSERT INTO SamepleUnique VALUES(1,'Ram')
INSERT INTO SamepleUnique VALUES(2,'Krish')
INSERT INTO SamepleUnique VALUES(3,Null)
INSERT INTO SamepleUnique VALUES(4,Null) --Error as Violation of UNIQUE KEY constraint 'UQ__SamepleU__737584F603317E3D'. Cannot insert duplicate key in object 'dbo.SamepleUnique'.
--The statement has been terminated.


By: Ashok Nalam | 12 Dec 2012 | SQL Server | Views: 5156 | Comments: 1 | Tags:Constraints  unique key 
Constant variables in .NET
Ashok Nalam
In this article we will discuss about constant variables in .NET and with sample program.
By: Ashok Nalam | 15 Dec 2012 | C# | Views: 8281 | Comments: 0 | Tags:const  variable 
Constructors in .NET
Ashok Nalam
In this article we will see about constructors in .net. and types of constructors with sample example.
By: Ashok Nalam | 01 Jan 2013 | VB.NET | Views: 7178 | Comments: 0 | Tags:C#  constructor  oops