Reputation: 2489
I need to start up a SQL Agent job when I click on some buttons on my ASP.NET page.
How do I let the job run in background without letting my ASP.NET page wait for the job to finish?
The idea is that one the button is clicked, the SQL Agent job does it's own stuff in the background without affecting my page.
I have something like this now:
SqlCommand cmd = new SqlCommand(“EXEC sp_start_job @Job_Name = ‘” + JobName + “‘”, conn);
cmd.CommandTimeout = 30;
cmd.ExecuteNonQuery();
Upvotes: 0
Views: 1088
Reputation: 241
'sp_start_job' should be asynchronous by nature and it won't wait for the job to complete.
Upvotes: 1