索引?怎么可能,楼上的,不要随便同意!他要求的是几个字段不可重复,我觉得使用规则才是最好的!--a,b,c 不可相同,使用规则的方法
create table TA
(
a int ,
b int ,
c int ,
check(not (a=b or a=c or b=c))
-- check(a<>b and a<>c and b<>c)
)--a,b,c 不可相同,使用约束的方法
create table TB (
a int,
b int,
c int,
constraint a check(not (a =b or b =c or c =a )),
constraint b check(not (a =b or b =c or c =a )),
constraint c check(not (a =b or b =c or c =a )),
)
create table TA
(
a int ,
b int ,
c int ,
check(not (a=b or a=c or b=c))
-- check(a<>b and a<>c and b<>c)
)--a,b,c 不可相同,使用约束的方法
create table TB (
a int,
b int,
c int,
constraint a check(not (a =b or b =c or c =a )),
constraint b check(not (a =b or b =c or c =a )),
constraint c check(not (a =b or b =c or c =a )),
)
错在楼主的要求不清!到底是横向,还是纵向!
纵向的用 马可的!