CREATE TRIGGER [tr_company_del] ON dbo.t_company FOR DELETE AS DECLARE @id int select @id=id from deleted if @id is not null BEGIN delete t_design where cid in (@id) delete t_company_appeal where cid in (@id) delete t_company_leadup where cid in (@id) delete t_company_revisit where cid in (@id) delete t_company_url where cid in (@id) END
FOR DELETE
AS
DECLARE @id int
select @id=id from deleted if @id is not null
BEGIN
delete t_design where cid in (@id)
delete t_company_appeal where cid in (@id)
delete t_company_leadup where cid in (@id)
delete t_company_revisit where cid in (@id)
delete t_company_url where cid in (@id)
END