Hi All
I create a update trigger for a table, if the specific column is updated, my trigger will save the old value, new value and the sql statement to another table, now old value and new value is in "inserted" and "deleted" virtual table, how to get the sql statement that cause the update?
I use this code to retrieve the sql statement:
select command,text FROM sys.dm_exec_requests er cross apply sys.dm_exec_sql_text(er.sql_handle) AS st WHEREer.session_id=@@SPID
The return result is not the SQL statement that cause the update but the "Create trigger" statement - I test the trigger just after create trigger.
What am I missing?