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,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time
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 (http://blog.SQLAuthority.com)




We can get this even by profiler too, right?
But is there anyway i get the queries executed only on a database rather than server instance itself?
This will help if when we are trying to understand a big application that talks to a database.
What about adding the user to the query?
sorry to ask my question here.
Just want to know how to retrieve data faster from sql server 2005 in VB.net 2005? Any idea? thanks.
When I try running this script I get the Message “sql_handle” is not a recognized table hints option. I am running 2005 but compatability mode is set to 80. Is there a way round this?
This works only at particular instance of time.
I want to record all the sql running/finished, its cpu time, etc
Hi
when i ran this query.it shows me the same query in the output.I think result expected would be a different query.
Does anybody know a query for SQL Server 2000?
Thank you!