Search code examples
sqlsql-server-2008-r2jobs

How to kill the currently executing query of a job in sql server 2008r2


I'm a SQL Server newbie and I have been given a small task around which I cannot wrap my head. I have to verify that if i kill the query which a sql server job is currently executing will the job continue running indefinitely or it will fail. Creating a small job that runs a long running sql query was easily accomplished, but i cannot get how to identify which task is currently running and kill it. I use this reference http://blog.sqlauthority.com/2009/01/07/sql-server-find-currently-running-query-t-sql/ But it doesnt show me the currently executing queries.

Sorry if this is a really silly question , but any help appreciated!

Thanks


Solution

  • Right click the server name and choose Activity Montior.

    Alternatively, you can query the process list with:

    select * from sys.dm_exec_requests
    

    An even better solution is sp_WhoIsActive from Adam Machanic, but that might be overkill for your situation.