货保金更改后解决方案【待完善】

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO 
CREATE TRIGGER TRG_JXDDMX_UPDATE 
   ON  [JXDDMX]
   AFTER UPDATE 
AS 
BEGIN 
	IF UPDATE(isxyhbj)
	BEGIN 
		UPDATE a
			SET a.isxyhbj = b.isxyhbj
		FROM jh_rkmx AS a
		     INNER JOIN Inserted AS b ON a.xgdjbh = b.djbh AND a.spid = b.spid 
		     
		UPDATE a
			SET a.isxyhbj = b.isxyhbj
		FROM TW_CGDD_PICI AS a
		     INNER JOIN Inserted AS b ON a.xgdjbh = b.djbh AND a.spid = b.spid 
		
		UPDATE a
			SET a.isxyhbj = c.isxyhbj
		FROM pf_ckmx AS a
		     INNER JOIN TW_CGDD_PICI AS b ON a.spid = b.spid AND a.pihao = b.pihao AND a.pici = b.pici
		     INNER JOIN Inserted AS c ON b.xgdjbh = c.djbh AND b.spid = c.spid 
		
		UPDATE a
			SET a.isxyhbj = c.isxyhbj
		FROM pf_ckmx_hbjfh AS a
		     INNER JOIN TW_CGDD_PICI AS b ON a.spid = b.spid AND a.pihao = b.pihao AND a.pici = b.pici
		     INNER JOIN Inserted AS c ON b.xgdjbh = c.djbh AND b.spid = c.spid      
	END
END
GO

 

你可能感兴趣的:(KSOA)