Create table table1
(
ID Int primary key
)
Create table table2
(
ID Int primary key constraint A1 Foreign Key references Table1
on Delete Cascade
)
我要改变table2中主键上已有的Constraint为级联删除和级联更新,sql语句怎样来写
(
ID Int primary key
)
Create table table2
(
ID Int primary key constraint A1 Foreign Key references Table1
on Delete Cascade
)
我要改变table2中主键上已有的Constraint为级联删除和级联更新,sql语句怎样来写
alter table 表名 add CONSTRAINT PK_1 foreign key(字段名) references 主表名
on delete cascade on update cascade