Home SQL Server How to Add Unique Constraint for multiple columns in SQL Server
How to Add Unique Constraint for multiple columns in SQL Server

From time to time you may need to modify your database structure to add unique constraint for multiple columns. Here's how to do it:

SYNTAX:

ALTER TABLE tblOperationMaintenance

ADD CONSTRAINT UQ_tblOperationMaintenance UNIQUE NONCLUSTERED

(

    [TaskListID],

    [GrpCounter],

    [OperationID],

    [MaintenanceID]

)

GO



Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

"