I have a stored procedure GenerateAttendance
, execution time will take approx 3-4 min. Meanwhile my program requests the same stored procedure for execute.
I want to restrict my program from executing it if it's currently running. Is there any way, in SQL Server 2008 R2 Express, to find the stored procedure is currently executing or what, before requesting to execute it again.
I tried below option but it does not work for me
SELECT OBJECT_NAME(@@PROCID)
select OBJECT_SCHEMA_NAME(@@PROCID)