2012-04-30 108 views

回答

2
ALTER TABLE dbo.YourTable 
ADD CONSTRAINT YourConstraintName UNIQUE (Column1, Column2) 
0
ALTER TABLE mytable 
ADD CONSTRAINT myconstraint UNIQUE NONCLUSTERED (
    Col1, 
    Col2 
) ON [PRIMARY] 

或者如果你喜歡使用索引:

CREATE UNIQUE NONCLUSTERED INDEX myindex ON mytable (
    Col1, 
    Col2 
) ON [PRIMARY]