• Jonathan Marshall (11/12/2013)


    Hello everyone,

    I'm searching to see how performance works on columns concat in the where clause.

    What are the search / performance ramifications?

    Any suggestions?

    WHERE

    [column1] + [column2]

    That would become a nonSARGable predicate. The value will have to be calculated for every single row in the result set. To make things even worse you will likely end up wrapping each column with an ISNULL because if either column is NULL the concatenation will be null. Perhaps if you can provide more details we can help come up with a solution that will work and be fast.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/