• There wasn't a missing part but rathe some confusion (there wasn't a table presented but two variables assigned with values and the first post did just include some plain values....)

    Anyway, here's something that should get you started:

    ;WITH cte AS

    (

    SELECT

    ConstraintBasedGroupId,

    T.c.value ('Body[1]','varchar(8000)') AS col

    FROM #temp t1

    CROSS APPLY t1.CONSTRAINTS.nodes('Constraints/Constraint/Expression') T(c)

    )

    SELECT

    cte.ConstraintBasedGroupId,

    LTRIM(split.item) AS item

    FROM cte

    CROSS APPLY

    dbo.DelimitedSplit8K(REPLACE(col,'||','|'),'|') split

    You'll need the DelimitedSplit8K function to split the data. If you don't have it in your tool box already, search this site for it (originally posted by Jeff Moden).



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]