Online Earning Sources (Without Investment)

If you want to post, send your post on dotnetglobe@gmail.com .Put 'Title' as 'Subject'

Pages

Monday, May 20, 2013

Insert multiple null values in Unique key index column

hello friends,

 

Here i am sharing scripts which can be useful to us in our developement

 

CREATE TABLE [dbo].[testUnique](

      [col1] [varchar](50) NULL,

      [ID] [int] IDENTITY(1,1) NOT NULL,

) ON [PRIMARY]

 

CREATE UNIQUE INDEX IX_testUnique ON testUnique(col1)

WHERE col1 IS NOT NULL –-Here we can set any value to which we want to allow multiple value

 

Insert into testUnique(col1)

values ('a'),(null),(null)

itworld