SQL Server Performance

view sql of running process

Discussion in 'Performance Tuning for DBAs' started by Mark_newdba, Oct 1, 2003.

  1. Mark_newdba New Member

    Hi All,

    I need to view the sql statement of a running process. How do I do it from sql ? Thanks.
  2. Twan New Member

    dbcc inputbuffer( @spid )

    where @spid is the spid of the process you're interested in

    Cheers
    Twan
  3. satya Moderator

    @spid value can get from SP_WHO or SP_WHO2 from query analyzer.

    _________
    Satya SKJ
    Moderator
    SQL-Server-Performance.Com
  4. Mark_newdba New Member

    Thanks for the info.

Share This Page