Red Gate forums :: View topic - Long running queries - stored procedures
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Monitor 4
SQL Monitor 4 forum

Long running queries - stored procedures

Search in SQL Monitor 4 forum
Post new topic   Reply to topic
Jump to:  
Author Message
DBdave



Joined: 03 Oct 2013
Posts: 8

PostPosted: Tue Jul 29, 2014 12:11 pm    Post subject: Long running queries - stored procedures Reply with quote

If a sproc is captured as a long running query the parameters used to execute the stored procedure are not captured which makes it harder to analyse the issue and makes the alert a little pointless.

Is there a way to find out what was passed into the sproc?
Back to top
View user's profile Send private message
chriskelly



Joined: 19 Apr 2010
Posts: 329
Location: Cambridge, UK

PostPosted: Wed Jul 30, 2014 2:00 pm    Post subject: Reply with quote

Thank you for your post.

SQL Monitor uses a SQL Server table valued function called sys.dm_exec_sql_text (based upon a sql_handle found using the view sys.dm_exec_query_stats) to gather information about queries which are run. These are used in a number of places including the long-running query alert.

sys.dm_exec_sql_text (Transact-SQL)
http://msdn.microsoft.com/en-gb/library/ms181929.aspx

sys.dm_exec_query_stats (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms189741.aspx

The tool uses a complex query to get this information, and unfortunately neither of these hold the parameters specified when running stored procedures. To the best of my knowledge there is no way to retrospectively find these out either.

I'm sorry that I don't have a better answer for you. But feel free to add any additional questions.
_________________
Chris Kelly
Technical Support Engineer
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group