How to run a long-running stored procedure on SQL Server, even if I get disconnected

azure-sql-database

I have a stored procedure in an Azure SQL Database that does not return a result and can take several hours to run. It takes one parameter, and I am running it through the query editor window in Management Studio on my local machine:

EXEC @return_value = dbo.ComputeBatchData @BatchId = 2

My problem: If I get disconnected, the procedure is cancelled.

The procedure does not need to run on a schedule or anything. I just want to run the procedure and not have to worry about disconnects.

Best Answer

Azure Automation: Schedule the Execution of SQL Jobs in Azure with Automation Service

and make a small powershell script and schedule it in the azure dashboard.