Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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)
 Calculate Quarter from Fiscal Date
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

micnie_2020
Posting Yak Master

Malaysia
232 Posts

Posted - 12/13/2012 :  22:07:06  Show Profile  Reply with Quote
Hi All,

Let said my Fiscal Year Start From Apr 12.

Calculation will start Apr/12. How to get below calculation:-

Q1 Apr/12-Jun/12
Q2 Jul/12-Sep/12
Q3 Oct/12-Dec/12
Q3 Jan/13-Mar/13

Please advise.

Thank you.

Regards,
Micheale

khtan
In (Som, Ni, Yak)

Singapore
17689 Posts

Posted - 12/14/2012 :  03:04:12  Show Profile  Reply with Quote

declare	@fiscal_year_start date

select	@fiscal_year_start	= '2012-04-01'

select	Q_start = dateadd(quarter, q - 1, @fiscal_year_start),
	Q_end	= dateadd(quarter, q, dateadd(day, -1, @fiscal_year_start))
from	(
		select	q = 1	union all
		select	q = 2	union all
		select	q = 3	union all
		select	q = 4
	) q



KH
Time is always against us

Go to Top of Page
  Previous Topic Topic Next 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.03 seconds. Powered By: Snitz Forums 2000