Capturing sql query text

  • I know there is a new function in 2005 that shows what the query text of the most recently executed command but can't remember the function name....can someone refresh my memory?

  • Are you thingking of the SQL_Text DMV?

    SELECT

    er.session_id, start_time, database_id, st.text

    FROM sys.dm_exec_requests er

    CROSS APPLY sys.dm_exec_sql_text(sql_handle) st

    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
  • Yep that's it....forgot that was in the management views. Thanks!

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

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