• gvoshol 73146 - Tuesday, November 14, 2017 5:35 AM

    Of course the absolute easiest way of doing it is
    WHERE YEAR([date]) = 2015
    But that's not sargable.  It doesn't matter if you're looking at only a few thousand rows in your table.  But if your table has hundreds of thousands or millions of rows, then performance will suffer greatly.

    I would argue that it does matter.  There is an adage that "If you fail to plan, you plan to fail."  This is very applicable to this situation, because using the SARGable method plans for growth, whereas the non-SARGable method does not.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA