Monday, June 7, 2010

Unique Index


-- To create a unique index:

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = N'IX_ClientsTable_ClientID_Name')

BEGIN

-- ClientID and Name will be unique per row

CREATE UNIQUE INDEX IX_ClientsTable_ClientID_Name

ON ClientsTable (ClientID, [Name])

END

GO

No comments: