sql server trigger after update old value new value

Solutions on MaxInterview for sql server trigger after update old value new value by the best coders in the world

showing results for - "sql server trigger after update old value new value"
Yannick
10 Oct 2016
1-- SQL Server (update my_table after update on my_table)
2CREATE TRIGGER trTest ON my_table AFTER UPDATE AS
3IF UPDATE (col_name)	-- Optional, for particular column
4BEGIN
5    UPDATE my_table SET my_col_date = getdate() FROM my_table 
6END
7-- Oracle (insert into log table after update on my_table)
8CREATE OR REPLACE TRIGGER trTest AFTER UPDATE ON my_table
9FOR EACH ROW
10BEGIN
11    INSERT INTO my_log_table (LOG_DATE, ACTION) VALUES (SYSDATE, 'Changed');
12END;