Sometimes I need execution of some SQL command or stored procedure not in-process, but as Asynchronous task, especially when I need to call long running SQL command inside a trigger or another stored procedure (for example, large web cache deleting after data update).
I created the stored procedure using job object of SQL server agent. You can run the sql command asynchronously directly from SQL, from another stored procedure, task or another sql server command or from external ASP/ASP Net application.
for 'Asynchronous Execution of T-SQL command, MSSQL' article
Copyright and use this code
The source code on this page and other samples at https://www.motobit.com/tips/ are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
2. Link this sample from you page.
<A Href="https://www.motobit.com/tips/detpg_async-execute-sql/" Title="Stored procedure executing sql command as a separated asynchronous process." >Asynchronous Execution of T-SQL command, MSSQL</A>
Do you like it? Rate me on LinkedIn
© 1996 - 2019 Antonin Foller, Motobit Software | About, Contacts