SQL 外键级联删除 删除父表数据同时删除相关子表
启用所有外键
exec sp_msforeachtable 'alter table ? check constraint all'
关闭所有外键
exec sp_msforeachtable 'alter table ? nocheck constraint all'
备注:一旦关闭,除非手动开启,不然外键无效
SQL在有索引的同时建立视图,无法用TRUNCATE删除