• Sean Lange (1/31/2014)


    VoldemarG (1/31/2014)


    so from everything I heard/read, would that be fair to conclude that option 2 is the way to go in the majority of cases?

    2) where databasename ='myDBname'

    and applicationname NOT LIKE 'SQLAgent%'

    and applicationname NOT LIKE ' SQL Server Log Shipping%'

    and applicationname NOT LIKE 'Spotlight Diagnostic%'

    If you need the wildcard then yes that would be the best way. Option 1 is nonSARGable and option 3 is not the same thing.

    Note that you have a leading space on your second condition and that if you add a leading wildcard it will become nonSARGable as well. So, what's the best option? I can't give a definite answer.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2