sql触发器级联删除
来源:未知 责任编辑:责任编辑 发表时间:2014-02-18 03:27 点击:次
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Description: 删除类别触发器
-- =============================================
ALTER TRIGGER [dbo].[trigDelete]
ON [dbo].[tb_Course]
instead of DELETE
AS
BEGIN
declare @ID int
select @ID = ID from deleted
--删除评论
delete tb_Content where OutlineID in (select ID from tb_Outline where CourseID=@ID)
--删除新闻
delete tb_Outline where CourseID=@ID
--删除类别
delete tb_Course where ID=@ID
END
作者 xuxujiang0
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>