Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Unique key on NULLABLE column?

Author  Topic 

diwakar_m
Starting Member

19 Posts

Posted - 2008-07-02 : 07:20:15
Hi,
I have a column with NULLS. How do i impose Unique key constraint on the column? Is there a way to ignore the existing data and create the constraint?
Please shed light on this.
Thanks in advance.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-02 : 08:18:15
Unique key only allows 1 null value.
Go to Top of Page

diwakar_m
Starting Member

19 Posts

Posted - 2008-07-02 : 08:22:37
i know that unique key allows atmost one NULL value. But here in my case, i have some 100 records, out of which, some 10 rows have NULL values. Will it still be possible to enforce the Unique key constraint someway or the other?
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-07-02 : 08:35:38
some ideas are discussed here:

http://www.devx.com/dbzone/Article/30786/0/page/2
http://www.eggheadcafe.com/software/aspnet/32070397/possible-to-simulate-a-un.aspx


- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-02 : 08:39:34
NO.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-07-02 : 10:24:55
quote:
Originally posted by sodeep

NO.



You should read the links I posted.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

diwakar_m
Starting Member

19 Posts

Posted - 2008-07-07 : 03:16:15
Thanks a lot.
Hope it will solve my problem.Apologize for the late reply.
Go to Top of Page
   

- Advertisement -