Dec
9
2008
This is more of a placeholder post, nothing complicated but wrote it today and thought it may be useful for some people learning SQL.
Had an instance today where someone wanted dates in a report in the following format;
Q4 2008
Easy enough!!!
DECLARE @myDate Datetime
SET @myDate = GETDATE()
SELECT 'Q' + CAST(DATEPART("q", @myDate) AS char(1)) + ' ' +
CAST(YEAR(@myDate) AS char(4)) AS FyQuarter
Nothing crazy nor excited, but useful!
Enjoy!