[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

INSERT PERIOD DAY OF DATE TO TABLE

Posted on 2011-10-13
2
Medium Priority
?
157 Views
Last Modified: 2012-05-12
Hi All,

I have below table say TableA :

1. Id --> '01', '02' and etc
2. FromDate (Always Monday)
3. ToDate (Always Sunday).

How could I insert it using constraint from Year 2011 to 2012.

Thank you.

0
Comment
Question by:emi_sastra
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 36962058
you should have or use a calendar table like described here:
http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html

from there, this will be "easy", as you can then query that table for years 2011 and 2012, taking only the "mondays", and adding up the 6 days to get the sunday following that monday

hope this helps
0
 
LVL 1

Author Closing Comment

by:emi_sastra
ID: 36962115
Hi angelIII,

I get it.

Thank you very much for your help.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

868 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