Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unique if Not Null

Status
Not open for further replies.

fluteplr

Programmer
Oct 23, 2000
1,599
US
I need a way to check that a value in a column is unique if it is not null. There can (and must be, in this case) be any number of records where the column is null. But if the column is not null the value must be unique.

Using a unique constraint does not seem to work, since it only allows one record with a null value.

Any ideas?

 
Thanks, Terry. Its better than nothing and it will sure beat tracking down the accidental duplicates.
 
I have to agree with his comment though. Why is it designed this way? I would not think that allowing one Null record would be useful in very many instances.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top