How to get the process ID of an Executed Query/SP ?

  • Hi All,

    I was doing EOD(runs with SP) process from front end, Sometimes I need to stop the EOD. I have a cancel button, but i do not know how to stop the process in back end. I use to terminate the application.

    Please tell me How to get the process id for giving query/SP and how to kill the process.

    Thanks in advance

    Bobby

  • A good starting point is the sp_who and sp_who2 system stored procedures (though sp_who2 isn't officially documented). These take information from a variety of system tables to include sysprocesses and producs a readable set of information.

    You may also take a look at DBCC INPUTBUFFER() as well as fn_get_sql in SP3 in order to confirm a SPID you suspect is actually the one you need to kill. More info on fn_get_sql:

    Books Online - fn_get_sql

    K. Brian Kelley
    @kbriankelley

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply