Add a function that returns the tsql_stack - by Ola Hallengren

Status : 


Sign in
to vote
ID 3141167 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 9/18/2017 5:30:48 AM
Access Restriction Public


In sys.dm_exec_requests you have a sql_handle, statement_start_offset, and statement_end_offset. This can be used to give you the currently executing stored procedure / function and statement.

It would be nice if you also could get the complete callstack. This information is available as xml in the extended event action [tsql_stack].

I would like to have a function that takes session_id and request_id as parameters, and returns the tsql_stack.
Sign in to post a comment.
Posted by Erland Sommarskog on 9/20/2017 at 1:09 PM
So this is generalisation of my item Provided that the DMV is implemented so that the current spid and request can get its stack without VIEW SERVER STATE, the function Ola calls for, meet my needs to.