select deqs.last_execution_time as [Time], dest.text as [Query] from sys.dm_exec_query_stats as deqs cross apply sys.dm_exec_sql_text(deqs.sql_handle) as dest order by deqs.last_execution_time desc
This is definitely a useful SQL snippet to see what's just happened when you're in a pinch.
Er. Looked cool. Thought i could use it. Tried it. Didn't have the access level on the SQL Server that I needed. :(
Perhaps its because its been a while since i have developed in a MS SQL environment (used to Oracle), but some more explanation about *what* the query is doing would help me understand how MS SQL Server works.
Still i copied the snippet into my SQL notebook. :)
You should only run this on a database you have access to. I'm not exactly sure what level of access you need in order to sys tables & stored procs. You might want to head over to Pinal Dave's post and ask the question there.
B. Adcock
EXACTLY what I was looking for. Thanks SO much for taking the time to share this. My head feels wonderful now that I have stopped ponding it on the desk.....
5 Comments
Comments for this entry have been disabled.