SP_Showplan

  • Does anyone know if there is a stored proc similar to Sybase sp_showplan for MSSQL  that will show the line number in a long running query as followed? Thanks in advance!

    1> sp_showplan 88,NULL,NULL,NULL

    2>

    QUERY PLAN FOR STATEMENT 42 (at line 162).

        STEP 1

            The type of query is WAITFOR.

    (return status = 0)

     
  • I don't know about a stored procedure but if you pull up Start,Programs, Microsoft SQL Server, Profiler you can set up a trace that may give you what you want.

  • You can try the following code for the queries that are running:

    select s.session_id, s.status, command, text, query_plan

    from

    sys.dm_exec_requests r

    join sys.dm_os_tasks t on r.session_id = t.session_id

    join sys.dm_exec_sessions s on r.session_id = s.session_id

    cross apply sys.dm_exec_query_plan(r.plan_handle)

    cross apply sys.dm_exec_sql_text(r.sql_handle)

    where

    r.session_id =

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

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