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 Development (2000)
 Unable to insert NULL value in MS SQL Server 2000

Author  Topic 

manufcs
Starting Member

1 Post

Posted - 2002-08-26 : 08:33:23
I am unable to insert record in a field which is null and unique. It does not accept NULL value again in the same field. It shows error UNIQUE KEY VIOLATION.

Please help


jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-08-26 : 08:37:13
For the purpose of a UNIQUE index, SQL treats NULL=NULL thus in a single column index you are only allowed one. Whilst this behaviour is inconsitent with the normal tratment of NULL as unknown and thus NULL<>NULL my suggestion is that if you plan to use a unique constraint/index on a column it should not allow NULL.


HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -