• WayneS (5/10/2012)


    Excellent question Mark. Actually, in the Qtr column in the CROSS APPLY, I use this calculation to determine what the month number is at the beginning of the quarter for the date:

    ((CEILING(MONTH(dt.SomeDate)/3.0)*3)-2) AS Qtr,

    In the example that you posted, it is specifying the third month, thus 2012-03-01.

    ah I glanced over that, but missed the implications of it. Which left me thinking you were stuffing in the quarter number, instead of the first month number of a given quarter.

    Makes sense, thanks!



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]