trigger to insert data into log table

also can do for INSERT

CREATE TRIGGER trig_vacReq
ON  dbo._vac
FOR DELETE
AS
BEGIN
INSERT INTO dbo._vacLog (vacRequestID, firstname, lastname, startdate, enddate, date_entered, LogDate, logevent)
SELECT vacRequestID, firstname, lastname, startdate, enddate, date_entered, GETDATE() as LogDate, ‘Deleted’ as LogEvent
FROM Deleted
END

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.