Which line within stored procedure

  • Hello, I am trying to find how far along a stored procedure is.

    I can tell that the stored procedure is running:

    SELECT DEST.[text]

    FROM sys.dm_exec_connections SDEC

    CROSS APPLY sys.dm_exec_sql_text (sdec.most_recent_sql_handle) AS DEST

    WHERE sdec.most_recent_session_id = 67;

    But I want to know what line it is on within the stored procedure.

    Thank you,

    DJJ

  • SELECT DEST.[text] ,

    Substring(DEST.TEXT, (r.statement_start_offset / 2) + 1, ( ( CASE r.statement_end_offset WHEN - 1 THEN

    Datalength(DEST.TEXT) ELSE r.statement_end_offset END - r.statement_start_offset ) / 2 ) + 1) AS statement_Line

    FROM sys.dm_exec_connections SDEC

    Join Sys.dm_exec_requests R on R.session_id=Sdec.most_recent_session_id

    CROSS APPLY sys.dm_exec_sql_text (sdec.most_recent_sql_handle) AS DEST

    WHERE sdec.most_recent_session_id = 67;

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Thank you, Roshan Joe,

    That was exactly what I needed!

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

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