Quote:i need to make second procdure run async i don't need a result from it
Instead of making it run asynchronously, why not use this method in C# instead of SQL stored procedure. See here, SqlCommand Class (System.Data.SqlClient) | Microsoft Docs
], all that needs to be done for the second query is, you execute the function and forget that it was ever called. You can do that using the Async
counterparts of the query execution functions.
SqlCommand.ExecuteReaderAsync Method (System.Data.SqlClient) | Microsoft Docs
] (Explore other options for other type of queries)
If you use the Async counterparts, then you can execute the first stored procedure, wait for the response (asynchronously, as it helps you write reactive-apps and doesn't block the threads unnecessarily) and for the second one, just call the function and do not wait for a response. The down side for this? The Task that gets created would be in the Thread Pool and underlying framework would still assume that this needs to be processed and waited for, thus causing memory leaks if your app exits prematurely. In this case, you can use SQL counterpart (see below).
There are some things that you need to know before diving into that.
c# - Horrible performance using SqlCommand Async methods with large data - Stack Overflow
But if you still want to go with a SQL approach, then you might want to use SQL Jobs and create a job that runs in the background, sql server - Can I launch a stored procedure and immediately return without waiting for it to finish? - Database Administrators Stack Exchange