Is it possible to check is there any stored proc currently running in SQL Server???
A:
There's the activity monitor in management studio. There's also sp_who and sp_who2. These will give you an idea of what is running.
However, if you need to programatically find out if a procedure is "in progress" or not to avoid calling it again then I'd consider a flag somewhere to indicate "SPIsRunning" that you set at the start and end of the procedure itself.
Robin Day
2009-08-19 06:59:13
A:
Via TSQL you could try evaluating the results of DBCC INPUTBUFFER for each SPID, but it's pretty cumbersome to do.
CodeByMoonlight
2009-08-19 07:07:56
A:
SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE dest.TEXT LIKE '%YOUR OBJECT NAME HERE%'
ORDER BY deqs.last_execution_time DESC
this is a nice query, but only tells you the last time the procedure started, not if it is still running
KM
2009-08-19 12:13:52