1.

What Are The Ways To Find What Code Is Running For Any Spid?

Answer»

Well there are many ways to do this.

  1. find the SPID which you want to analyze. An spid is assigned as soon as a client connection is established with the SQL server. To find the spid you can run any of the FOLLOWING command:
    1. SP_WHO2 ‘ACTIVE’ — This will give you only active spids.
    2. SELECT * FROM sys.dm_exec_requests
  2. Get the spid from above TWO QUERIES and use any of the following query to get what is happening behind that spid.
    1. dbcc inputbuffer()
    2. sql2005 and sql2008 – SELECT * FROM sys.dm_exec_sql_text()
    3. sql2005 and sql2008 – SELECT * FROM fn_get_sql()

Well there are many ways to do this.



Discussion

No Comment Found