sql server drop talbe 自动删除关联的外键 ,权限体系(二)


alter table dbo.Sys_PowerTeamForUser add constraint FK_Sys_User_Sys_PowerTeamForUser foreign key (Sys_UserID) references Sys_User( Sys_UserID) on DELETE CASCADE on UPDATE CASCADE
alter table dbo.Sys_PowerTeamForUser add constraint FK_PowerTeam_Sys_PowerTeamForUser foreign key (Sys_PowerTeamID) references dbo.Sys_PowerTeam(Sys_PowerTeamID) on DELETE CASCADE on UPDATE CASCADE

alter table dbo.Sys_PowerTeamForMenu add constraint FK_Sys_MenuID_Sys_PowerTeamForMenu foreign key ( Sys_MenuID) references dbo.Sys_Menu (Sys_MenuID) on delete cascade on update cascade
alter table dbo.Sys_PowerTeamForMenu add constraint FK_PowerTeam_Sys_PowerTeamForMenu foreign key (Sys_PowerTeamID) references dbo.Sys_PowerTeam( Sys_PowerTeamID) on update cascade on delete cascade

 

 

 

--级联跟新、 删除 外键.

你可能感兴趣的:(SQL Server)