Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Query attualmente in esecuzione all'interno di una stored procedure

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