Constraints (original) (raw)

Is there a way to get SQLServer to recognise that unique constraints don't apply to nulls? For example:

create table Blah ( Id integer primary key, Token char(16) null unique ) go insert into Blah values (1, '1234567890abcdef') go insert into Blah values (2, null) go insert into Blah values (3, null)

"Violation of UNIQUE KEY constraint 'UQ__Blah__61274A53'. Cannot insert duplicate key in object 'Blah'."

This works fine in other databases: null is not equal to null.

Dear community members, Can anybody help me to find the data warehouse community?

This is in response to my question on 2/4/2013 for SQL Version 2000 (should work in subsequent versions if you follow my comments) Design: User…

I'm thinking about doing this because our number of ad-hoc requests to run jobs has increased to an annoying level. Does anyone out there have…