sybe
asked on
Index, but Field value must be unique or Null
I am working on a database that synchronizes records in a table "person" from another database, but also has records that are not imported. So I created a field in my table which holds the id of the record in the other database, I need to be sure which records correspondences with which record in the other database.
The value of this field should be either be null (no corresponding record in the other database) or unique: there should not be two of the same values. But I can not create a unique index, because then SQL Server complains about several records having value Null.
How can I solve this?
The value of this field should be either be null (no corresponding record in the other database) or unique: there should not be two of the same values. But I can not create a unique index, because then SQL Server complains about several records having value Null.
How can I solve this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no unfortunately MS SQL Server doesn't allow UNIQUE WHERE NOT NULL Indexes like DB2/UDB
ASKER