Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Executing batches asychronously? Expand / Collapse
Author
Message
Posted Wednesday, November 14, 2007 8:09 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, December 12, 2012 11:12 PM
Points: 13, Visits: 50
Say I have a procedure inside which I have the task of sending out emails...this may be another procedure or a batch of statements. Can I run this separately without my main batch processing not waiting or blocking for this task?
Post #422114
Posted Wednesday, November 14, 2007 9:22 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 7:39 AM
Points: 231, Visits: 655
No. You can only do this by having a job that runs (say every 5 minutes) to send the emails or execute other batch proceses.

Jez
Post #422158
Posted Wednesday, November 14, 2007 9:34 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 4:01 AM
Points: 734, Visits: 645
You could use the sp_add_job to create a job which deletes itself after running and then execute it using sp_start_job.



Nuke the site from orbit, its the only way to be sure...
Post #422172
Posted Wednesday, November 14, 2007 11:20 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, December 12, 2012 11:12 PM
Points: 13, Visits: 50
"Create a job which deletes itself..."???!
Explain.
Post #422242
Posted Wednesday, November 14, 2007 3:32 PM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 4:01 AM
Points: 734, Visits: 645
The syntax for sp_add_job has a parameter called @delete_level. If you use this you can set the job to delete itself on completion (wether it is successful or not).

You will need to look at sp_add_job,sp_add_jobstep & sp_start_job. (all in msdb)

Quickest and easiest way to work all this out is to run sql profiler filtered by your username and create a job in enterprise manager. It will give you all the code you need. Job explore the options a little more to make sure your getting everything you want.




Nuke the site from orbit, its the only way to be sure...
Post #422355
Posted Thursday, November 15, 2007 4:18 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 4:01 AM
Points: 734, Visits: 645
Arun,

Has this helped?




Nuke the site from orbit, its the only way to be sure...
Post #422539
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse