Home > Archive > Microsoft SQL Server forum > December 2005 > Periodic run of stored procedure









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Periodic run of stored procedure
brogdonm

2005-12-19, 8:25 pm

Hi,

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

Thanks,
Mike
<><

Dan Guzman

2005-12-19, 8:25 pm

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.googlegroups.com...
> Hi,
>
> I have this stored procedure that I need to run daily, how do I do
> this?
>
> Thanks,
> Mike
> <><
>



brogdonm

2005-12-19, 8:25 pm

Is it a bad idea to do something like

WHILE (1<>0)
BEGIN
WAITFOR TIME '04:00'
Greg D. Moore \(Strider\)

2005-12-20, 3:23 am


"brogdonm" <Brogdons@gmail.com> wrote in message
news:1135036649.313243.99790@f14g2000cwb.googlegroups.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,
> <><
>



Dan Guzman

2005-12-20, 3:23 am

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.googlegroups.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,
> <><
>



brogdonm

2005-12-27, 3:23 am

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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com