create table t1(id int identity primary key,col int)
create table t2(id int references t1(id) on update cascade on delete cascade,col int)
–alter table t2 add foreign key (id) references t1(id) ON UPDATE CASCADE ON DELETE CASCADE
insert t1 values(0)
insert t1 values(2)
insert t2 select 2,9
–delete t2
delete t1
select * from t2
drop table t2
drop table t1
上面ON UPDATE CASCADE,ON DELETE CASCADE两个选项,指明以后author表的id字段有delete,update操作时,myBBS表中的id也会被级联删除或更新。如果没有选中,是不可以对author表中已被myBBS表关联的id进行update或者delete操作的。