How to get a multiple select to populate into a temp table?

  • Alright thanks to everyone that provided some help I was able to get it with a few tricks with the suggestions here.

    Here is my final query:

    DECLARE @sample TABLE (field XML)
    INSERT @sample
    VALUES('Xml Code (sensitive information)')

    SELECT c.value('(ParameterValue[Name ="TO"]/Value/text())[1]', 'nvarchar(max)') AS Emailreceipt, c.value('(ParameterValue[Name ="CC"]/Value/text())[1]', 'nvarchar(max)') AS EmailCopy,
    c.value('(ParameterValue[Name ="RenderFormat"]/Value/text())[1]', 'nchar(3)') AS RenderFormat, c.value('(ParameterValue[Name="AKDunsNumber"]/Value/text())[1]', 'int') AS AKDunsNumber
    FROM @sample AS smpl
    CROSS APPLY smpl.field.nodes('/ParameterValues') T(c)

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply