find missing word in comma delimited string by comparing with another string

given two tables with columns like so:
id Col1
1 blue,green,pink
2 fat,ugly,stupid,smart
3 larry,james,philip,john

id Col2
3  larry,james,tih,john,ann,,
2 fat,krank,ugly,stupid,smart
1 blue,green,pink,yellow

I want to be able to find and add (append) to TableB (col2) all the missing words found in TableA, Col1 using the id as the relationship that link both tables.  The end result should be Col1 a subset of Col2. words are comma seperated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peterslove53Author Commented:
i got the answer using the DelimitedSplit8K function, found here

DECLARE @String1 varchar(30) = '356,840',
        @String2 varchar(30) = '840,356'

            SELECT fn.Item from dbo.DelimitedSplit8K(@String1,',') fn
            SELECT fn.Item from dbo.DelimitedSplit8K(@String2,',') fn
            PRINT 'No Differences found'
            PRINT 'they are not the same, regardless of order'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott PletcherSenior DBACommented:
I thought you wanted to update tableb with the missing value(s)?  Sorry I spent time on it if you don't really need that:

IF OBJECT_ID('tempdb..#missing_values') IS NOT NULL
    DROP TABLE #missing_values
CREATE TABLE #missing_values (
    id int,
    value varchar(500)    
CREATE CLUSTERED INDEX #missing_values__CL ON #missing_values ( id, value )

INSERT INTO #missing_values
SELECT, a_list.item
FROM TableA a
CROSS APPLY dbo.DelimitedSplit8K(a.Col1, ',') AS a_list
    SELECT, b_list.item
    FROM TableB b
    CROSS APPLY dbo.DelimitedSplit8K(b.Col2, ',') AS b_list
        b_list.item > ''
) AS b_split ON = AND
    b_split.item = a_list.item
    a_list.item > '' AND IS NULL
ORDER BY id, item
--SELECT 'TableA' AS table_name, * FROM TableA
--SELECT 'TableB' AS table_name, * FROM TableB
--SELECT '#Missing_values' AS table_name, * FROM #missing_values

SET Col2 = Col2 + missing.[values]
FROM TableB b
    SELECT, (SELECT ',' + value FROM #missing_values mv WHERE = ORDER BY value FOR XML PATH('')) AS [values]
    FROM (
        FROM #missing_values
    ) AS ids
) AS missing ON =

peterslove53Author Commented:
thank you ScottPletcher, that is even more handy. I was doing it a long and expensive way.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

peterslove53Author Commented:
Hi ScottPletcher, i implemented your code above but i am getting a syntax error.  
"    Incorrect syntax near '.'     "

and it is from this line
CROSS APPLY dbo.DelimitedSplit8K(b.srch_string, ',') AS b_list
Scott PletcherSenior DBACommented:
You didn't select my response as any part of your answer.  Good luck with your implementation errors.
peterslove53Author Commented:
i figured out why i was getting the error. it has nothing to do with the code. my database not operate in Compatibility mode 90 or above. Cant change that bc of other applications. i ll have to find another way of solving the problem
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.