sql2005
/*已选车型禁止删除*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER ondelete
ON carseries
AFTER DELETE
AS
BEGIN
if exists(select sc_series from sellcar,deleted where deleted.cs_id=sellcar.sc_series)
rollback tran
else
commit tran
END
GO
sql2000
/*级连更新用户名字*/
CREATE TRIGGER myfirst ON lx_user
FOR UPDATE AS IF UPDATE(u_fuze) BEGIN
UPDATE lx_genzong
SET g_fuze = i.u_fuze
FROM lx_genzong g, deleted d, inserted i
WHERE g_id = d.u_id
end