klewis10367
MIS
I am trying to create a trigger that will update fields of the inserted data based on another table. I am getting the trigger to fire but it is not updating the last record that is being inserted. Any ideas?
Code:
ALTER TRIGGER [dbo].[SOP10200_kml] ON [dbo].[SOP10200] after insert
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
UPDATE dbo.SOP10200 set dbo.SOP10200.ITEMDESC = RTRIM(dbo.B4602240.BSSI_Description) + '-' + CAST(MONTH(dbo.B4602243.STRTDATE) AS varchar(2)) + '/' + CAST(DAY(dbo.B4602243.STRTDATE) AS varchar(2))
FROM dbo.B4602243 INNER JOIN
dbo.B4602240 ON dbo.B4602243.BSSI_Tenant_Lease_Number = dbo.B4602240.BSSI_Tenant_Lease_Number AND
dbo.B4602243.LOCNCODE = dbo.B4602240.LOCNCODE AND dbo.B4602243.LNITMSEQ = dbo.B4602240.LNITMSEQ AND
dbo.B4602243.BSSI_Charge_ID = dbo.B4602240.BSSI_Charge_ID INNER JOIN
dbo.SOP10200 ON dbo.B4602243.SOPTYPE = dbo.SOP10200.SOPTYPE AND dbo.B4602243.SOPNUMBE = dbo.SOP10200.SOPNUMBE
END