CREATE TRIGGER trig_customerinfo_deleteupdate
ON customerinfo
FOR UPDATE
AS
If UPDATE(customerno)
BEGIN
select orderid from orderinfo where orderinfo.customerno = (select customerno from deleted)
if @@rowcount > 0
begin
RAISERROR ('不能修改编号,有相应的记录在订单表上', 16, 1)
ROLLBACK TRANSACTION
end
END
GO
ON customerinfo
FOR UPDATE
AS
If UPDATE(customerno)
BEGIN
select orderid from orderinfo where orderinfo.customerno = (select customerno from deleted)
if @@rowcount > 0
begin
RAISERROR ('不能修改编号,有相应的记录在订单表上', 16, 1)
ROLLBACK TRANSACTION
end
END
GO
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货