I have a stored procedure that is currently running, and seems to hang/lock on a specific query. How can i see which query? Preferably without modifying the proc.
Using
DBCC Inputbuffer (65)
gives me
Language Event 0 EXEC mySP;
Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure. In the Execute Procedure dialog box, specify a value for each parameter and whether it should pass a null value.
To list running queries, we need to use the 'show processlist' command. The following is the query. mysql> SHOW processlist; The following is the output of the above query.
We can not directly use stored procedures in a SELECT statement.
SELECT SUBSTRING(st.text, ( r.statement_start_offset / 2 ) + 1,
( ( CASE WHEN r.statement_end_offset <= 0
THEN DATALENGTH(st.text)
ELSE r.statement_end_offset END -
r.statement_start_offset ) / 2 ) + 1) AS statement_text
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(sql_handle) st
WHERE session_id = 65
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With