SQL SERVER – Find Currently Running Query – T-SQL

This is the script which I always had in my archive. Following script find out which are the queries running currently on your server.

SELECT sqltext.TEXT,
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext

While running above query if you find any query which is running for long time it can be killed using following command.

KILL [session_id]

Reference : Pinal Dave (https://blog.sqlauthority.com)

SQL Scripts, SQL Server Security
Previous Post
SQL SERVER – sqlcmd vs osql – Basic Comparison
Next Post
SQLAuthority News – Author Visit – Mumbai, India – From January 8, 2008 to January 11, 2008

Related Posts

60 Comments. Leave new

Leave a Reply