Sql-server – Execute Stored Procedure that cannot be manually stopped

sql serversql-server-2005

I am looking for a solution to:

  1. Allow an admin to manually run a stored procedure
  2. Once the stored procedure runs the same admin cannot stop it using the "Cancel Executing Query"
  3. The stored procedure must be invoked from SSMS ONLY.
  4. No other external program or language except for MS Management Studio and TSQL can be used.

I have tried creating a stored procedure than invokes another stored procedure, but it did not work. Any ideas are welcome….

Best Answer

You could create a stored procedure that invokes another stored procedure asynchronously either by spawning a SQL Server Agent Job or using Service Broker.

It would still be possible for someone with sufficient permissions to stop the procedure from executing though (but not via the "Cancel Executing Query" button as your first procedure would return immediately with execution of the main procedure being carried out on a different spid).