Add a function that returns the tsql_stack
In sys.dmexecrequests you have a sqlhandle, statementstartoffset, and statementend_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 sessionid and requestid 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.