Please write
SET XACT_ABORT ON
USE EIMif exists (select 1 from sysobjects where name = 'tr_update_pis_ishavepic' and type = 'tr') drop trigger tr_update_pis_ishavepicGOcreate trigger tr_update_pis_ishavepicon PicRelationshipfor insertAS set XACT_ABORT on declare @sysid int --set @sysid = 3 declare @itemid varchar (20) select @itemid = correLativeItemID, @ sysid = rateysystemid from inserted if @SYSID = 3 Update szdb2.pis.dbo.tb_brm_estate set ishave_pic = 1 where est_id = @itemidgo