Hi,
With the query below it is possible to view commands that have already been executed in the SQL SERVER instance.
SELECT DMExQryStats.last_execution_time AS [Executed At], DMExSQLTxt.text AS [Query]
FROM sys.dm_exec_query_stats AS DMExQryStats CROSS APPLY sys.dm_exec_sql_text(DMExQryStats.sql_handle) AS DMExSQLTxt
ORDER BY DMExQryStats.last_execution_time DESC
If you want to check for especificios commands, add the WHERE clause to search the command content.
Example:
If you want to search all UPDATES performed in your database, add this clause WHERE
WHERE lower(substring(DMExSQLTxt.text,1,6))='update'
Comments
Post a Comment