This should give you the fiscal year start date for any given date.SELECT a.DT, YearStart = dateadd(yy,datediff(yy,'19001001',dateadd(mm,-9,a.DT)),'19001001')from ( -- Test data select DT = getdate() union all select DT = convert(datetime,'20110930 23:59:59.997') union all select DT = convert(datetime,'20111001') union all select DT = convert(datetime,'20120930 23:59:59.997') union all select DT = convert(datetime,'20121001') ) a
Results:DT YearStart----------------------- -----------------------2012-04-12 10:54:22.100 2011-10-01 00:00:00.0002011-09-30 23:59:59.997 2010-10-01 00:00:00.0002011-10-01 00:00:00.000 2011-10-01 00:00:00.0002012-09-30 23:59:59.997 2011-10-01 00:00:00.0002012-10-01 00:00:00.000 2012-10-01 00:00:00.000(5 row(s) affected)
CODO ERGO SUM