Call SQL Stored Procedure Asyncronouslyhttp://forums.asp.net/t/1588170.aspx/1?Call+SQL+Stored+Procedure+AsyncronouslyMon, 06 Sep 2010 06:24:36 -040015881704017245http://forums.asp.net/p/1588170/4017245.aspx/1?Call+SQL+Stored+Procedure+AsyncronouslyCall SQL Stored Procedure Asyncronously <p>Hello,</p> <p>I have a C# web page that calls a stored procedure. The page passes few parameters to the stored procedure and call it. The stored procedure does so many time consuming tasks on a huge number of database records but does not return any value. </p> <p>Since the page is not expecting any return from the stored procedure, I want to execute the stored procedure asyncronously so that the user can continue working on the web page and other web pages while the stored procedure is running in the background. Also, I do not want the web server processes to be busy with the running stored procedure.</p> <p>Any help, please.</p> <p><br> </p> <p>Best regards,</p> <p>Imran<br> </p> 2010-08-09T12:23:30-04:004018048http://forums.asp.net/p/1588170/4018048.aspx/1?Re+Call+SQL+Stored+Procedure+AsyncronouslyRe: Call SQL Stored Procedure Asyncronously <p>you can initiate a callback to do that.</p> <p>check this link</p> <p><a href="http://www.simple-talk.com/dotnet/asp.net/asynchronous-client-script-callbacks/">http://www.simple-talk.com/dotnet/asp.net/asynchronous-client-script-callbacks/</a></p> 2010-08-09T19:51:52-04:004027078http://forums.asp.net/p/1588170/4027078.aspx/1?Re+Call+SQL+Stored+Procedure+AsyncronouslyRe: Call SQL Stored Procedure Asyncronously <p>Thanks Sansan. But this is not what I need. Read the scenario carefully<br> </p> <p><br> </p> 2010-08-14T05:06:28-04:004027093http://forums.asp.net/p/1588170/4027093.aspx/1?Re+Call+SQL+Stored+Procedure+AsyncronouslyRe: Call SQL Stored Procedure Asyncronously <p>are you passing any input parameters, if not then why not schedule the job within your DB. If you are passing parameters then brief your requirements plz.<br> </p> 2010-08-14T05:28:45-04:004039977http://forums.asp.net/p/1588170/4039977.aspx/1?Re+Call+SQL+Stored+Procedure+AsyncronouslyRe: Call SQL Stored Procedure Asyncronously <p>Hi tanatrajan,</p> <p>The application includes some calculations of items. The user has a button to re-calculate an item. When he clicks the button, the page will call a stored procedure that will insert a record in a table with re-calculation requests. Then the same stored proceedrue will call another stored procedure to process re-calculating the items in the table one by one. Something like the following</p> <p><pre class="prettyprint">ALTER Procedure [re_calculate_item] (@item_id int, @requested_by varchar(50) = null) as insert into t_item_recalculate (item_id, requested_by, requested_on, status) values (@item_id, @requested_by, getdate(), 1) exec re_calculate_pending</pre><br> re_calcualte_pending is the stored procedure that does a huge amount of processing that consumes time. But it does not return any value, it only updates few tables with re-calculated values.<br> </p> 2010-08-22T05:50:06-04:004062466http://forums.asp.net/p/1588170/4062466.aspx/1?Re+Call+SQL+Stored+Procedure+AsyncronouslyRe: Call SQL Stored Procedure Asyncronously <p>Any help, please.&nbsp;</p> 2010-09-06T03:03:14-04:004062672http://forums.asp.net/p/1588170/4062672.aspx/1?Re+Call+SQL+Stored+Procedure+AsyncronouslyRe: Call SQL Stored Procedure Asyncronously <p>&nbsp;i) Threading.<br> ii) Open that page from where&nbsp;processing start in another window.<br> <br> iii) I am quite hopefull about this method.<br> <strong>schedule the job,</strong>according to the requirment,data and trafiic u can schedule the time frequency.<br> See,User open that page,input some data and submit.Your store procedure start working.<br> Here don't call ur SP rather store the input from individual user in seperate table along with suitable id.<br> Structure of new table (id,parameter1,parameter1 from user.......... and status (bit).<br> <br> And in ur SP,make some changes.Like The Sp will pick all record whose status=1<br> Cursor or <strong>while loop</strong><br> Do its work as usual<br> and finally update the new table status=0.<br> <br> Again pick next id and so on.<br> </p> <p>&nbsp;<br> On fix time job will start automatically.<br> and user can continue doing its job.<br> It has ceratin benefit also,application will become fast.and so on.<br> Only thing is I am not sure about is Frequency Of that Page .<br> How frequently that page is use ?<br> <br> <br> any problem ask.<br> </p> 2010-09-06T06:24:36-04:00