Add a function that returns the tsql_stack
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.
Upvotes: 6<=-=Sep 20 2017 1:09PM=-=>
So this is generalisation of my item http://connect.microsoft.com/SQLServer/feedback/details/2781373. 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.<=-=Jan 3 2018 8:31AM=-=>
Thanks for the suggestion. We’ll keep this item open for future consideration.