Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sql query help

Posted on 2016-08-20
7
Medium Priority
?
115 Views
Last Modified: 2016-09-01
I need help creating the sql query to handle recurring tasks. I am creating a task which can run once, weekly bi-weekly, monthly , quarterly, annually.

The task table have
taskID,
friquencyID,
 name,
taskStartdate
taskStatus
0
Comment
Question by:erikTsomik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 41763634
Define 'task'.  Offhand SQL Server Agent allows for execution of SSIS packages/stored procedures/executables/whatever on a scheduled basis.   Also, having a SQL Server Calendar Table can help you with the date math.
1
 
LVL 19

Author Comment

by:erikTsomik
ID: 41766254
The task is the task that get assigned to the client in either fixed date or can be recurring task that repeats daily,weekly bi-weekly, monthly , quarterly, annually.

For example, do the car oil change it a recurring task that repeats  every 6 month.
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 41766298
I think you need to define your requirements with more precision.

e.g.
Do you have table(s) for these tasks already? or are you asking for assistance in defining the table(s)?
If you have the table(s) please provide the definition(s) of them

Do you want new rows created for "recurring tasks"?
 If yes, how far ahead should this be done?
 Would a "look ahead" period differ for each of these:
             daily,weekly bi-weekly, monthly , quarterly, annually.

It looks to me like you need a stored procedure that you can run as a job, it would scan the task definitions and generate a set of rows to comply with those. But the rules need to be defined - in detail.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 19

Author Comment

by:erikTsomik
ID: 41766310
Here is the table definition
taskID,
 name,
taskStartdate
taskStatus
repeat  if 0 no repeat, 1-  daily,2-weekly, 3-bi-weekly, 4-monthly ,5- quarterly, 6-annually.
0
 
LVL 49

Accepted Solution

by:
PortletPaul earned 2000 total points
ID: 41766740
Good start, but what are you expecting if "today" is 2016-09-01 and  I enter these rows?

askID,  name, taskStartdate, taskStatus
1, aaaa, 2016-09-01, 0
1, bbbb, 2016-09-01,1
1, ccccc, 2016-09-01, 2
1, dddd, 2016-09-01, 3
1, eeee, 2016-09-01, 4
1, fffffff, 2016-09-01, 5
1, gggg, 2016-09-01, 6

What do you want to happen?
e.g.
more rows get generated in that same table?
rows get added to a different table?
how many rows for EACH taskStatus value will get entered
(e.g. for annual is it just one extra row)

BE SPECIFIC please (& using examples is better than just words alone)
0
 
LVL 1

Expert Comment

by:Brad Featherstone
ID: 41780604
If you are using SQL Server, take a look at creating an SQL Server Agent Job and assigning it to a schedule.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 41780642
Hi Brad - Welcome to Experts Exchange.  Just so you know, the question has already been answered, and your comment is identical to the first comment provided.  

Feel free to comment in questions as you wish, but please make sure it's not a repeat point.

Thanks, and again welcome.
Jimbo
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question