sql约束 sql创建索引

1、alter table testTB add constraint U_check check(birthday<=getdate())

这句话就约束了出生日期必须小于等于今天,也可以在建表的时候写在最后为 check(birthday<=getdate())

2、创建索引

1 create unique index idx_id_birthday
2 on testTB(ID,birthday)

 

posted on 2012-12-19 16:21  yj_smile  阅读(172)  评论(0编辑  收藏  举报