SPID

  • Hi Folks..

    Just want to know lastn night we had issues with long running queries and we identify the session and killed it.

    But i want to know which query was running on that particular SPID so is there any way to find out ?

    Thanks

  • There would have been a way before you killed it, but not now.

    With the connection still open, you could query sys.dm_exec_connections, cross apply sys.dm_exec_sql_text using the most_recent_sql_handle column. But that would have had to be done prior to killing the SPID. Nothing's possible now unless you had some form of tracing running at the time.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks for info ya i am trying to look in default trace file .but i dont have access to go there . but thanx for help

  • The default trace does not contain last run SQL statements, DML or anything like that. It's a light-weight trace that stores DDL, some security info, DB and server config changes and little more.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ya thats true i just figured out ..Thank for your kind reply.

Viewing 5 posts - 1 through 4 (of 4 total)

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