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


#1

Hai,
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.

Regards,
Riya.
sql developer


#2

Are you using Hibernate to call this stored procedure?


#3

Hai vlad
Yes i am using it.

Thanks,
riya.
sql developer


#4

You cannot do easily because SQL Server communication is synchronous by default.

Check out this StackOverflow question and answers for some workarounds.


#5

Hai vlad,
Thanks i will check them

Regards,
Riya.