Unix Technical Forum

Periodic run of stored procedure

This is a discussion on Periodic run of stored procedure within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I have this stored procedure that I need to run daily, how do I do this? Thanks, Mike ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 03:16 PM
brogdonm
 
Posts: n/a
Default Periodic run of stored procedure

Hi,

I have this stored procedure that I need to run daily, how do I do
this?

Thanks,
Mike
<><

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 03:16 PM
Dan Guzman
 
Posts: n/a
Default Re: Periodic run of stored procedure

One method is to schedule the proc execution using a SQL Server Agent job.
You can create a job using the EM or SSMS GUI.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"brogdonm" <Brogdons@gmail.com> wrote in message
news:1135034300.442082.324910@g14g2000cwa.googlegr oups.com...
> Hi,
>
> I have this stored procedure that I need to run daily, how do I do
> this?
>
> Thanks,
> Mike
> <><
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 03:16 PM
brogdonm
 
Posts: n/a
Default Re: Periodic run of stored procedure

Is it a bad idea to do something like

WHILE (1<>0)
BEGIN
WAITFOR TIME '04:00'
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 03:16 PM
Greg D. Moore \(Strider\)
 
Posts: n/a
Default Re: Periodic run of stored procedure


"brogdonm" <Brogdons@gmail.com> wrote in message
news:1135036649.313243.99790@f14g2000cwb.googlegro ups.com...
> Is it a bad idea to do something like
>
> WHILE (1<>0)
> BEGIN
> WAITFOR TIME '04:00'
> .
> .
> .
> END
>
> It seems like that would work as long as WAITFOR actually yields the
> processor.


There's far better ways of doing this, as Dan suggested, SQL Server agent is
the way to do it.


>
> Mike,
> <><
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 03:16 PM
Dan Guzman
 
Posts: n/a
Default Re: Periodic run of stored procedure

I've seen WAITFOR DELAY used in order to execute a proc at very frequent
intervals (e.g. every minute or less). However, a scheduled job is a better
fit for less frequent executions since that gives you job history and
failure notification.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"brogdonm" <Brogdons@gmail.com> wrote in message
news:1135036649.313243.99790@f14g2000cwb.googlegro ups.com...
> Is it a bad idea to do something like
>
> WHILE (1<>0)
> BEGIN
> WAITFOR TIME '04:00'
> .
> .
> .
> END
>
> It seems like that would work as long as WAITFOR actually yields the
> processor.
>
> Mike,
> <><
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-29-2008, 03:19 PM
brogdonm
 
Posts: n/a
Default Re: Periodic run of stored procedure

Thanks guys I will look into that now that I am off of my Christmas
Vacation. I really appreciate all of the replies.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com