Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server - How I build time dimension 4-4-5?

Status
Not open for further replies.

DiegoErnesto

Programmer
Nov 28, 2001
41
EC
Hi;

I need to build a time dimension for 4-4-5 period.

Thanks.
 
Yikes. I would build a separate table with 365 days and their 4/5week range or period number.

example DateTable
Date , Period , DateRange
Jan 1 2003, Jan-4week, Jan 1 - Jan 28
Jan 2 2003, Jan-4week, Jan 1 - Jan 28
....etc...
Jan 29 2003, Feb-4week, Jan 29 - Feb 25
....etc...
Feb 26 2003, Mar-5Week, Feb-26 - Apr 1
Feb 27 2003, Mar-5Week, Feb-26 - Apr 1
etc... until Dec31.

Join
Maintable.Date to DateTable.Date
get Date Range or Period value.

You might even be able to do it using start and enddate In the DateTable. While you are at it, you could also add Quarter, Week Number, Half Year, 10 Day Cycles, Weekago Date, Monthago Date, or any other date grouping. [ur]www.eSearing.com[/url]
version 3
Photography, Flash Experiments, Stuff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top