Set up a year parameter to catch values within a fiscal year
I work in an environment where the fiscal year is April 1st 2011 to March 31st 2012
In my current query (datatset ) I'm gathering records with a year paramter
select
distinct(year(createdon))
as
Year
from
Filterednew_table
order
by
year
the
problem is this query grabs only the fiscal year...2011 for example...what I'd like to do is grab fiscal year 2011-2012 and have it select values for Months April to March.
Does anyone know how I can do this?
December 13th, 2011 4:43pm
DECLARE @yearParam int;
DECLARE @fiscalYearBegin DATETIME;
DECLARE @fiscalYearEnd DATETIME;
SET @yearParam = 2011;
SET @fiscalYearBegin = CONVERT(datetime, CONVERT(varchar(4),@yearParam) + '-04-01');
SET @fiscalYearEnd = CONVERT(datetime, CONVERT(varchar(4),@yearParam+1) + '-03-31');
SELECT @fiscalYearBegin;
SELECT @fiscalYearEnd;
Josh Ash
Free Windows Admin Tool Kit Click here and download it now
December 13th, 2011 8:31pm
thank you so much!
December 14th, 2011 9:43am