SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Executing batches asychronously?


Executing batches asychronously?

Author
Message
Arun T Jayapal
Arun T Jayapal
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 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?
Jez-448386
Jez-448386
SSC-Addicted
SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)SSC-Addicted (418 reputation)

Group: General Forum Members
Points: 418 Visits: 1134
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
EvilPostIT
EvilPostIT
SSC Eights!
SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)

Group: General Forum Members
Points: 818 Visits: 648
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... w00t
Arun T Jayapal
Arun T Jayapal
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 Visits: 50
"Create a job which deletes itself..."???!
Explain.
EvilPostIT
EvilPostIT
SSC Eights!
SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)

Group: General Forum Members
Points: 818 Visits: 648
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... w00t
EvilPostIT
EvilPostIT
SSC Eights!
SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)SSC Eights! (818 reputation)

Group: General Forum Members
Points: 818 Visits: 648
Arun,

Has this helped?



Nuke the site from orbit, its the only way to be sure... w00t
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search