Skip to main content
Participant
December 3, 2008
Answered

Don't want to wait for query results

  • December 3, 2008
  • 2 replies
  • 634 views
Hi everyone.

I'm on CF 7 and SQL Server 2005.

I'm calling a stored procedure through my CF code. The proc could potentially take an hour or so to run. I'd like the proc to run on SQL Server, but do not want my CF page to wait for the results before proceeding, I just want the code that follows the proc to run while the database server does it's thing silently in the background. Is there any way to do this?

Thanks
This topic has been closed for replies.
Correct answer JR__Bob__Dobbs-qSBHQ2
You might try creating a job that invokes your long running sproc. In CF call the sp_start_job system stored procedure to start your job. I think that sp_start_job returns when the job starts, not when the job ends, but you'll need to test this.

http://msdn.microsoft.com/en-us/library/ms186757(SQL.90).aspx

2 replies

JR__Bob__Dobbs-qSBHQ2Correct answer
Inspiring
December 3, 2008
You might try creating a job that invokes your long running sproc. In CF call the sp_start_job system stored procedure to start your job. I think that sp_start_job returns when the job starts, not when the job ends, but you'll need to test this.

http://msdn.microsoft.com/en-us/library/ms186757(SQL.90).aspx
Inspiring
December 3, 2008
schedule the stored procedure to run independantly of your page.



RadamsGAuthor
Participant
December 4, 2008
quote:

Originally posted by: Dan Bracuk
schedule the stored procedure to run independantly of your page.



but in that case, i'd have to make the schedule run every 5 seconds or so. not ideal.

this is for a report generation tool. the user can run one report or several, all with the same proc. if they're running just one report, i don't want to have them wait for the scheduled sql job to run for them to get the results (supposed to be an instant kind of thing).

...i'll try the other idea - calling a proc that calls the proc