CREATE TRIGGER tr_update_Products ON [dbo].[Products] FOR UPDATE AS DECLARE @date datetime BEGIN IF @@ROWCOUNT = 0 RETURN SET @date = GETDATE() INSERT INTO NorthwindLog.dbo.[Products_UpdatedLog] (FKey, ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, UpdateUser, UpdateTime) SELECT IDL.PKey, I.ProductID, I.ProductName, I.SupplierID, I.CategoryID, I.QuantityPerUnit, I.UnitPrice, I.UnitsInStock, I.UnitsOnOrder, I.ReorderLevel, I.Discontinued, USER, @date FROM Inserted AS I INNER JOIN NorthwindLog.dbo.Products_InsertedDeletedLog AS IDL ON I.UniqueID = IDL.UniqueID END GO