In SQL Server, is there a way to determine the values of the parameters passed to an executing stored procedure
15
votes
4
answers
28142
views
One way to determine the executing stored procedure is to use "dynamic management" methods, like so:
SELECT
sqlText.Text, req.*
FROM
sys.dm_exec_requests req
OUTER APPLY
sys.dm_exec_sql_text(req.sql_handle) AS sqltext
However, this only displays the text of the stored procedure's create statement. e.g.:
CREATE PROCEDURE IMaProcedure @id int AS SELECT * FROM AllTheThings Where id = @id
Ideally I'd like to see what the parameters were for the running procedure that are causing it to run so long for the particular set of offending parameters.
Is there a way to do that? (In this question Aaron Bertrand mentions DBCC InputBuffer , but I don't think that's appropriate for this problem.)
Asked by user420667
(261 rep)
Jun 28, 2016, 04:50 PM
Last activity: Jan 18, 2024, 07:55 PM
Last activity: Jan 18, 2024, 07:55 PM