• Lot's of assumptions here including all of Jeff's, Lowell's that you don't have an abbreviation like COR that matches to Corporation and that also there are not extra parens in Table2, but here's a shot at it:

    WITH Table1([AppID],[Appname]) AS (

    SELECT 'Null','CSO Services Operations' UNION ALL

    SELECT 'Null',' CSP' UNION ALL

    SELECT 'Null','AAC Claims Systems'

    )

    ,Table2([AppID],[Appname]) AS (

    SELECT '1','Corporate Services Operations(CSO)' UNION ALL

    SELECT '2','Credit Servicing Portal(CSP)' UNION ALL

    SELECT '3','American Assuarance Company (AAC) Claims Systems'

    )

    SELECT a.*, e.*

    FROM Table2 a

    CROSS APPLY dbo.PatternSplitCM(a.Appname, '[()A-Za-z]') b

    CROSS APPLY (SELECT RIGHT(Item, LEN(Item)-CHARINDEX('(', Item))) c(Item2)

    CROSS APPLY (SELECT '%' + STUFF(Item2, LEN(Item2), 1, '') + '%') d(Item3)

    INNER JOIN Table1 e ON e.AppName LIKE Item3

    WHERE [Matched]=1 AND CHARINDEX('(', Item) > 0 AND CHARINDEX(')', Item) > 0

    PatternSplitCM can be found in the 4th article in my signature links.

    I wouldn't want to be responsible for this running in Prod though without a whole lot of real thorough testing through all the possible cases. Still, it might be possible to make it work if you could apply additional assumptions like that the abbreviation always starts in the first non-blank character of Table1.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St