/*使用sp_helpconstraint来查看约束信息*/
use school
go
execute sp_helpconstraint student
go
/*禁用city列上的约束*/
alter table student
nocheck constraint ck_student_city
go
/*启用city列上约束*/
alter table student
check constraint ck_student_city
go
/*重新在学生表格上创建外键约束*/
alter table student
add constraint fk_student_teacher_id_teacher_id
foreign key(teacher_id) references teachers(id)
on delete cascade
go