declare @d datetime
set @d = GETDATE()
select
DATEADD(yyyy, DATEDIFF(yyyy, 0, @d), 0) as [CalendarYear]
select
case
when DATEPART(M, @d) >= 4 then DATEADD(mm, 3, DATEADD(yyyy, DATEDIFF(yyyy, 0, @d), 0))
when DATEPART(M, @d) < 4 then DATEADD(mm, -9, DATEADD(yyyy, DATEDIFF(yyyy, 0, @d), 0))
end as [FinancialYear]
Tuesday, May 22, 2012
Find current financial and Calendar Year in SQL Server
Labels:
SQL Server
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment