I wonder how to use UPDATE trigger and get the old value of some column before update. I need to insert that value to a table. I created a trigger but it doesn't return any value. I have the print statement but nothing gets printed.
CREATE TRIGGER Test_Update ON Test FOR UPDATE
AS
DECLARE
@rowID int,
@date DATETIME
SELECT @rowID = AutoID, @date = Date
FROM Deleted
print 'rowID = ' + Cast(@rowID as nvarchar(20))
CREATE TRIGGER Test_Update ON Test FOR UPDATE
AS
DECLARE
@rowID int,
@date DATETIME
SELECT @rowID = AutoID, @date = Date
FROM Deleted
print 'rowID = ' + Cast(@rowID as nvarchar(20))