-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sp_BlitzWho - shows procedure definition not the current statement in query_text if proc is executing for the first time #3163
Comments
…ment BrentOzarULTD#3163 - sp_BlitzWho - shows procedure definition not the current statement. Ameneded query_text column to get statement offsets from sys.dm_exec_requests instead of sys.dm_exec_query_stats
Howdy sir! Did you want to code a change for this? If not, let me know and I'll close it - the current implementation is alright for my purposes. |
Hi Brent, yep I have a changed lined up for this one just forgot to create a pull request. Doh! Incoming... |
@Adedba I haven't heard back from you, so I'll go ahead and close this for now, but if you decide you want to work on it, you can leave a comment here when you're ready to do a pull request, and I can reopen it. |
…requests instead of sys.dm_exec_query_stats BrentOzarULTD#3163 - Ameneded query_text column to get statement offsets from sys.dm_exec_requests instead of sys.dm_exec_query_stats
Thanks Brent, I did a commit which was ready to go just forgot to raise a pull request but I have created one now. |
Thanks for the pull request! Looks good, merging into the dev branch. Will be in the next release with credit to you in the release notes. |
Version of the script
SELECT @Version = '8.11', @VersionDate = '20221013';
What is the current behavior?
If you have a stored procedure executing for the first time (not in the plan cache) the query_text column will not show you the current statement being executed, it will show you the stored procedure definition instead.
If the current behavior is a bug, please provide the steps to reproduce.
Clear your cache (DBCC FREEPROCCACHE)
create a stored procedure:
Query window 1: Execute stored procedure:
EXEC usp_GetTopVotesByYearAndMonth;
Query window 2: Execute sp_BlitzWho:
EXEC sp_BlitzWho
Observer the query_text column, this will contain the stored procedure definition.
Now execute your stored procedure again and the execute sp_BlitzWho whilst running and you will notice that this time the statement being executed will now show in the query_text column.
What is the expected behavior?
For the current statement in a stored procedure to show in the query_text column
Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
Tested on SQL 2016
The text was updated successfully, but these errors were encountered: