• Alvin Ramard (5/28/2014)


    ChrisM@Work (5/28/2014)


    Alvin Ramard (5/28/2014)


    Luis Cazares (5/27/2014)


    Alvin,

    The code makes clear that there's a concatenation based on multiple values on a single column.

    CASE WHEN A.[COL_1] LIKE '%cricket%' THEN 'ck' + ',' ELSE '' END +

    CASE WHEN A.[COL_1] LIKE '%soccer%' THEN 'sc' + ',' ELSE '' END +

    ....

    That means that the table is not properly normalized. I'm not sure why nimalatissa would say that they are normalized and at the same time there's a column with comma separated values.

    Luis, the code says NOTHING about the tables! Stop making assumptions!!

    The comma separated values are the output of the query. Did you ever consider they might not be inserted into a table?

    nimalatissa (5/27/2014)


    ...the column in this table have comma separated values...

    Alvin, quit giving Luis a hard time!

    Sorry Chris, but Luis is doing nothing but making this more confusing for the OP. There's nothing to back up his assumptions and the suggestion he gave is WRONG!

    Its quite clear that a csv column is not only not normalised, but given the leading % in the search condition (doing a LIKE '%someTerm%' search) will create a performance issue. I credit Luis for sniffing this out from the beginning.

    ----------------------------------------------------