I am trying to develop a unique index.
CREATE UNIQUE NONCLUSTERED INDEX NCI_NewUnique
ON [NewUnique]([U1])
WHERE (ISNULL([MyField], '') = '')
My error is
Incorrect WHERE clause for filtered index 'NCI_NewUnique' on table 'NewUnique'.
Here is another attempt; This one I have removed the ISNULL(MyField, '') part. Why cannot this one have an OR?
CREATE UNIQUE NONCLUSTERED INDEX NCI_NewUnique
ON [NewUnique]([U1])
WHERE (
([MyId] IS NULL)
OR
([MyId] IS NOT NULL AND [MyField] IS NOT NULL)
)
Error is:
Incorrect syntax near the keyword 'OR'.