SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Table From Start and End Date with Period
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kalaiselvan
Posting Yak Master

India
109 Posts

Posted - 01/23/2013 :  10:01:59  Show Profile  Reply with Quote
Hi,
Need a Table with single column From the following Input.

Start Date = 01 Jan 2011
End Date = 01 Dec 2012

TABLE FOR PERIOD=MONTHLY
[PERIOD]
JAN 2011
FEB 2011
MAR 2011
APR 2011
MAY 2011
JUN 2011
JUL 2011
AUG 2011
SEP 2011
OCT 2011
NOV 2011
DEC 2011
JAN 2012
FEB 2012
MAR 2012
APR 2012
MAY 2012
JUN 2012
JUL 2012
AUG 2012
SEP 2012
OCT 2012
NOV 2012
DEC 2012


TABLE FROM PERIOD=QUARTER
[PERIOD]
JAN 2011
APR 2011
JUL 2011
OCT 2011
JAN 2012
APR 2012
JUL 2012
OCT 2012


TABLE FROM PERIOD=HALF
[PERIOD]
JAN 2011
JUL 2011
JAN 2012
JUL 2012


TABLE FROM PERIOD=YEARLY
[PERIOD]
JAN 2011
JAN 2012


Depends on Period Chosen Need to Built the Single Column table. Help me to fix this Functionality.


Regards,
Kalai

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 01/23/2013 :  10:17:03  Show Profile  Reply with Quote
You should have a calendar table of dates (F_TABLE_DATE by Michael Valentine Jones, which can be found in the scripts forum here, is very useful), everything else you asked for can be derived from that table. Let the front-end do the formatting.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000