Result: Nov 25 2010
SELECT substring(convert(char(20), GETDATE(), 100), 1, 3)
+ ' ' + convert(char(4), year(GETDATE()))
Result: Nov 2010
SQL query to display Fiscal Month and Year
SELECT CASE WHEN MONTH(GETDATE()) >= 4 THEN MONTH(GETDATE()) - 3 ELSE MONTH(GETDATE()) + 9 END AS FiscalMonth
,CASE WHEN MONTH(GETDATE()) >= 4 THEN YEAR(GETDATE()) ELSE YEAR(GETDATE()) - 1 END AS FiscalYear
Result display Fiscal Month and Year
No comments:
Post a Comment