Search code examples
sql-serverquery-optimizationsql-server-2014long-running-processesdmv

is there a way to identify a query that has been cancelled?


I was running some big updates and while checking what else was running on that server, I saw an expensive query running, I then asked my friend who was running spid 91 if he could stop it, then he cancelled his query but there was no way I could see using any DMV that that was really the case.

what I could see is on the pictures below:

enter image description here

enter image description here

there is nothing there that tells me that this query has been cancelled.

is there any way, (preferably using DMVs or T-SQL) to find the processes that have been cancelled?


Solution

  • Select session_id, Command
      From sys.dm_exec_requests
    

    Look for killed/rollback or rollback in command.