Tuesday, July 16, 2013

TSQL statement of running queries

In a SQL production environment it can happen that you see heavy transactions. With next query you can retrieve the TSQL statement of a process you see in master..sysprocesses.

SELECT Text,hostname, program_name, nt_username,*
FROM Master..sysprocesses
CROSS APPLY sys.dm_exec_sql_text (sql_handle)
WHERE Spid > 50


You can extend the WHERE clause with SPID = XX or something else you wnat to filter on.

2 comments:

unknown said...

Interesting blog on the TSQL running queries". I also a need the information on these topic. Do you these reason I'm not cover the assignment taking online service from the assignment assistance UK this is the one the best writer in the UK.

Unknown said...

I have completely read your blog. Recently have i complete change the our home roof from the Roofing Corpus Christi this is the best service in the USA.