What’s up SQL? – Number 5 – Query Percentage

We’ve seen how to find out what users are doing in our SQL Server boxes, but, how about knowing where a query i in it’s execution?

Well, I found a query that help’s with that.

First you need to know the session id you want to monitor. Then open a query windows and type:

select percent_complete,
       dateadd (second ,( datediff( second ,start_time , getdate())* 100 )/percent_complete , start_time)
       as EstimatedEndTime, command
from sys . dm_exec_requests
where session_id = ID_OF_SESSION

This will show you the percentage of completion, an estimate for the completion and the command being executed.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *