USE UFDATA_201_2026
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create TRIGGER dbo.DZX_AA_BatchProperty_cBatchProperty7
ON dbo.AA_BatchProperty
AFTER INSERT ,UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE AA_BatchProperty SET AA_BatchProperty.cBatchProperty7 = cCusName
FROM AA_BatchProperty
LEFT JOIN rdrecords01 on rdrecords01.cInvCode = AA_BatchProperty.cInvCode AND rdrecords01.cBatch = AA_BatchProperty.cBatch
LEFT JOIN Customer ON rdrecords01.cDefine25 = Customer.cCusCode
left JOIN inserted ON AA_BatchProperty.cBatchPropertyGUID = inserted.cBatchPropertyGUID
left JOIN deleted ON AA_BatchProperty.cBatchPropertyGUID = deleted.cBatchPropertyGUID
WHERE 1 = 1
AND (inserted.cBatchPropertyGUID <> '0' OR deleted.cBatchPropertyGUID <> '0')
END
GO