Run sql script and not wait for completion

I have a sql stored procedure that runs for about 3 minutes, I am looking to execute this stored procedure from asp.net, but I know that if I do this, then asp.net will most likely shut down.

I am thinking of creating work in sql to execute this stored procedure, and ask asp.net to call the stored procedure to call this task. I have a table that updates after the stored procedure starts and ends.

My application will use this to determine when the script ended, however, I would like to know if there is another way to start the stored procedure and not wait until it finishes to send the response.

I just want to know if there is a more efficient way to do this, or I should just stick to creating tasks for scripts that run forever.

+3
source share
3 answers

: . , , SQL. ( ADO.NEt async BeginExecuteXXX, , ), SQL Server .

+2
+3

If you do not need the result, you can simply use the method SqlCommand.BeginExecuteNonQuery(). This will run the command in the background thread. Learn more about MSDN .

0
source

Source: https://habr.com/ru/post/1761772/


All Articles