March 9, 2012 at 7:18 am
I now that in Oracle there is a table that stores SQL Statements that have been executed.
Does SQL Server have a DMV that stores T-SQL Statements executed?
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 9, 2012 at 7:20 am
i believe this is only items that have a chached plan that was recently used; if the command is not in this, you'd have to add a trace to capture it in the future.
SELECT DEST.TEXT
FROM sys.[dm_exec_connections] SDEC
CROSS APPLY sys.[dm_exec_sql_text](SDEC.[most_recent_sql_handle]) AS DEST
--WHERE SDEC.[most_recent_session_id] = @spid
Lowell
March 9, 2012 at 7:47 am
sys.dm_exec_query_stats will show you an aggregate of all the calls against the database for the queries still in cache. I suspect that's what you need.
Otherwise, you can use sys.dm_exec_requests to see the calls that are currently executing.
If you really need to monitor individual calls, I'd suggest setting up an extended events session to capture them out to a file.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply