Reputation: 7415
On my test server there is a large query that is running (which is okay), but it is a multi-line query. E.g. in SSMS I told it to run something like:
begin transaction;
query;
query;
query;
query;
commit;
I want to see which query within the list is executing. Selecting text
from sys.dm_exec_sql_text
returns the entire statement, not the particular command that is executing within the list. Is there a way to view the individual commands that are being processed?
In case it matters (sometimes it does), this is running on a SQL Azure instance.
Upvotes: 4
Views: 345
Reputation: 121
Here you can find my complete set o queries useful to show transactions running, time-wait events and open transactions with plan and sql texts: http://zaboilab.com/sql-server-toolbox/queries-to-see-rapidly-what-your-sql-server-is-doing-now
Upvotes: 0
Reputation: 93754
Use DBCC INPUTBUFFER
DBCC INPUTBUFFER(your session id)
It will display the query that is executing in your session
Upvotes: 3