Filed under General
I have an integer column in one of my database tables that allows nulls. What I want is for any value other than nulls to be unique. Here's how I did it:
CREATE UNIQUE NONCLUSTERED INDEX idx_SupplierID_notnull
ON Brands(SupplierID)
WHERE SupplierID IS NOT NULL;
Brands is my table and SupplierID is the column I want to be unique.
e974b4d0-6187-45c5-88bb-8c7e778375cb|0|.0