sql server2005 添加约束

来源:互联网 发布:手游源码 编辑:程序博客网 时间:2024/06/05 10:04
alter table studentInfo        --给stuID字段添加主键约束        add constraint  Pk_stuID primary Key (stuID)alter table studentInfo--给stuName字段添加唯一约束add  constraint UQ_stuName Unique  (stuName)alter table studentInfo--给stuAge字段添加检查约束add constraint CK_stuAge Check(stuAge>=18 and stuAge<=40)alter table studentInfo--给stuAddress字段添加默认约束add constraint DF_stuAddress default(' 住址不详 ') for stuAddress

原创粉丝点击