日期:2014-05-17 浏览次数:20513 次
CREATE TRIGGER [dbo].[DeletePcChild] ON [dbo].[pro_categories]
FOR DELETE
AS
BEGIN
;with cte as(
select pcid from pro_categories where pcParentid in(select pcID from deleted)
union all
select a.pcid from pro_categories a inner join cte b on a.pcParentid=b.pcid
)delete from pro_categories where pcid in(select pcid from cte)
end