Skip to content

Instantly share code, notes, and snippets.

@ejhayes
Created July 28, 2010 22:01
Show Gist options
  • Save ejhayes/496489 to your computer and use it in GitHub Desktop.
Save ejhayes/496489 to your computer and use it in GitHub Desktop.
SELECT FY_ID, RIGHT(YEAR(FY_START_DATE), 2) + '/' + RIGHT(YEAR(FY_END_DATE), 2) AS FY_NAME, CONVERT(varchar, FY_START_DATE, 101) AS FY_START_DATE,
CONVERT(varchar, FY_END_DATE, 101) AS FY_END_DATE, '7/1/' + DATENAME(yyyy, FY_START_DATE) AS q1_start, '9/30/' + DATENAME(yyyy, FY_START_DATE)
AS q1_end, '10/1/' + DATENAME(yyyy, FY_START_DATE) AS q2_start, '12/31/' + DATENAME(yyyy, FY_START_DATE) AS q2_end, '1/1/' + DATENAME(yyyy,
FY_END_DATE) AS q3_start, '3/31/' + DATENAME(yyyy, FY_END_DATE) AS q3_end, '4/1/' + DATENAME(yyyy, FY_END_DATE) AS q4_start, '6/30/' + DATENAME(yyyy,
FY_END_DATE) AS q4_end, CREATED_USER, CREATED_DATE, UPDATED_USER, UPDATED_DATE, DELETED
FROM ats.FY_FISCAL_YEAR
WHERE (FY_END_DATE < DATEADD(year, 6, GETDATE()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment