• Jeff Moden (1/9/2013)


    Alan.B (1/9/2013)


    AndrewSQLDBA (1/9/2013)


    Its worth noting that the following is sargable.

    LIKE '%abc%'

    Did you mean "NOT" SARGable because it sure doesn't look SARGable from here. 😉 And, I agree... nice use of NTILE.

    Thank you very much Jeff. One year ago I had never heard of windows functions, set-based SQL, or a tally table. I think I'm starting to get it and hope to someday be able to write queries like you, Dwain, Lynn and others on SSC.

    Yes - I meant NOT SARGable.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001