Tom Mayfield
Tom Mayfield

Reputation: 6276

SQL Compact unique index that allows nulls

For SQL Server, I'm familiar with using nullbusters or filtered indexes to have a unique index that allows null values.

Is there any way in SQL Compact to have a unique index that allows multiple null values?

Upvotes: 1

Views: 1025

Answers (1)

ErikEJ
ErikEJ

Reputation: 41799

No! SQL Server Compact checks for duplicate values when the index is created (if data already exists) and checks each time data is added with an INSERT or UPDATE statement. Duplicates must be eliminated before a unique index can be created on the columns. If duplicate key values exist, the CREATE INDEX statement is canceled and an error is returned. A unique index can be created only on columns that are defined as NOT NULL. http://technet.microsoft.com/en-us/library/ms345331.aspx

Upvotes: 2

Related Questions