SQL Script Help....

  • Folks:

    I need help with a SQL Script to shred my XML data which is stored in a SQL Table. The XMLData is in this format. Here is one of the record.

    <?xml version="1.0" encoding="utf-16"?>

    <?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:Annual-Cert:-myXSD-2011-12-28T21-32-27" solutionVersion="1.0.0.105" productVersion="12.0.0.0" PIVersion="1.0.0.0" href="http://ABC/MCSClarify/Cert/Annual/Forms/template.xsn"?>

    <?mso-application progid="InfoPath.Document" versionProgid="InfoPath.document.2"?>

    <my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-12-28T21:32:27" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US">

    <my:field1>CERT FORM</my:field1>

    <my:field2 />

    <my:STList />

    <my:Chk_listYes>true</my:Chk_listYes>

    <my:Chk_listNo>false</my:Chk_listNo>

    <my:field6 />

    <my:Chk_familymembernone>true</my:Chk_familymembernone>

    </my:myFields>

    Thanks !

  • Nevermind... I got the SQL query.

    Thanks.....

  • Great you found the solution.

    Would you mind sharing it so others might benefit? Remeber, it's a two-way street here 😉



    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]

  • ;WITH XMLNAMESPACES ( default 'http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-12-28T21:32:27')

    SELECT

    c.value('field1[1]','varchar(100)'),

    c.value('field2[1]','varchar(100)')

    --, other nodes here

    FROM

    YourTableName y

    CROSS APPLY yourXmlCol.nodes('//myFields') t(c);

Viewing 4 posts - 1 through 3 (of 3 total)

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