Home Forums SQL Server 2008 T-SQL (SS2K8) Remove the first two characters in a column value if they meet a certain condition RE: Remove the first two characters in a column value if they meet a certain condition

  • talking of being SARGable, i was reading this article:

    http://en.wikipedia.org/wiki/Sargable

    and didn't quite understand this line

    The typical thing that will make a sql query non-sargable is to include a function in left part of a condition of a Where clause.

    one of the examples given was:

    Non-Sargable: Select ... WHERE DateDiff(mm,Date,GetDate()) >= 20

    does that mean that if it was written like so:

    Select ... WHERE 20 < DateDiff(mm,Date,GetDate())

    that it would be Sargable, as the function is now on the Right hand side of a condition in a where clause?