Sunday, March 25, 2012

Advice Needed

I need to set up a table to define times when tasks will run. It needs to
allow for multiple times per day and if the task should run on the weekends.
Once the task has run once for the specified service window for that time of
day I need to prevent the task from running again. I do not have a lot of
SQL experience and was wondering the best way to set up the table structure
might be. Any thoughts, examples or links would be greatly appreciated.
Thank you.>> I need to set up a table to define times when tasks will run. It needs to allow for multiple times per day and if the task should run on the weekends. <<
CREATE TABLE TaskSchedule
(task_name CHAR(20) NOT NULL,
task_time DATETIME NOT NULL,
PRIMARY KEY (task_name, task_time),
..);
Just fill in the schedule for each task.
>> Once the task has run once for the specified service window for that time of day I need to prevent the task from running again. <<
Use a query with "task_time >= CURRENT_TIMESTAMP" so you ignore past
events. What were you thinking about doing? We do not compute things
in SQL; we put them in tables and do joins.|||I'm wondering why you need a table. If the tasks are SQL Scripts, then just
run a scheduled DTS job or Store Procedure. You can create jobs to run at
the specific times and they would only run once. Plus you can have failure
emails if the job fails and will contact you.
"--CELKO--" wrote:
> >> I need to set up a table to define times when tasks will run. It needs to allow for multiple times per day and if the task should run on the weekends. <<
> CREATE TABLE TaskSchedule
> (task_name CHAR(20) NOT NULL,
> task_time DATETIME NOT NULL,
> PRIMARY KEY (task_name, task_time),
> ..);
> Just fill in the schedule for each task.
> >> Once the task has run once for the specified service window for that time of day I need to prevent the task from running again. <<
> Use a query with "task_time >= CURRENT_TIMESTAMP" so you ignore past
> events. What were you thinking about doing? We do not compute things
> in SQL; we put them in tables and do joins.
>|||Not sure myself becuase of my limited experience. I do know that I need the
ability to have my sproc run more then once in a day, possibly different
times on different days, and the ability to skip weekends. Can I do all
this using a scheduled DTS job or sproc? Thank you.
"Darren" <Darren@.discussions.microsoft.com> wrote in message
news:9AE28789-D43D-422F-B185-D682C5BF289A@.microsoft.com...
> I'm wondering why you need a table. If the tasks are SQL Scripts, then
> just
> run a scheduled DTS job or Store Procedure. You can create jobs to run at
> the specific times and they would only run once. Plus you can have
> failure
> emails if the job fails and will contact you.
> "--CELKO--" wrote:
>> >> I need to set up a table to define times when tasks will run. It
>> >> needs to allow for multiple times per day and if the task should run
>> >> on the weekends. <<
>> CREATE TABLE TaskSchedule
>> (task_name CHAR(20) NOT NULL,
>> task_time DATETIME NOT NULL,
>> PRIMARY KEY (task_name, task_time),
>> ..);
>> Just fill in the schedule for each task.
>> >> Once the task has run once for the specified service window for that
>> >> time of day I need to prevent the task from running again. <<
>> Use a query with "task_time >= CURRENT_TIMESTAMP" so you ignore past
>> events. What were you thinking about doing? We do not compute things
>> in SQL; we put them in tables and do joins.
>>|||Yes you can run the job except for the weekends. In Enterprise Manager, go
to the Managment Folder, Expand SQL Server Agent, and you will see the jobs
section. Create a new job and in the Schedules tab create a new schedule and
you will see the options you can do. Good luck.
Darren
"Code Boy" wrote:
> Not sure myself becuase of my limited experience. I do know that I need the
> ability to have my sproc run more then once in a day, possibly different
> times on different days, and the ability to skip weekends. Can I do all
> this using a scheduled DTS job or sproc? Thank you.
>
> "Darren" <Darren@.discussions.microsoft.com> wrote in message
> news:9AE28789-D43D-422F-B185-D682C5BF289A@.microsoft.com...
> > I'm wondering why you need a table. If the tasks are SQL Scripts, then
> > just
> > run a scheduled DTS job or Store Procedure. You can create jobs to run at
> > the specific times and they would only run once. Plus you can have
> > failure
> > emails if the job fails and will contact you.
> >
> > "--CELKO--" wrote:
> >
> >> >> I need to set up a table to define times when tasks will run. It
> >> >> needs to allow for multiple times per day and if the task should run
> >> >> on the weekends. <<
> >>
> >> CREATE TABLE TaskSchedule
> >> (task_name CHAR(20) NOT NULL,
> >> task_time DATETIME NOT NULL,
> >> PRIMARY KEY (task_name, task_time),
> >> ..);
> >>
> >> Just fill in the schedule for each task.
> >>
> >> >> Once the task has run once for the specified service window for that
> >> >> time of day I need to prevent the task from running again. <<
> >>
> >> Use a query with "task_time >= CURRENT_TIMESTAMP" so you ignore past
> >> events. What were you thinking about doing? We do not compute things
> >> in SQL; we put them in tables and do joins.
> >>
> >>
>
>sql

No comments:

Post a Comment