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