Convert xml file into sql table

  • This xml file have to be converted into table format which is shown below.The 3rd column mentioned in the table have to be extracted based on maleworker and femaleworker tabs.

    <?xml version="1.0"?>

    <ROOt>

    <Document Type="workersinput" Version="1.0.0" />

    <Manager Name = "Robby">

    <workers>

    <Maleworker Value = "Antony">

    <Femaleworker Value = "Fileebarta"/>

    </Maleworker>

    </workers>

    </Manager>

    <Manager Name = "Walton">

    <workers>

    <Maleworker Value = "Jhony">

    <Femaleworke Value = "jennifer"/>

    </Maleworker>

    </workers>

    </Manager>

    </Root>

    Output table :

    Managerworkerssex

    RobbyAntonyM

    RobbyFileebartaF

    WaltonJhony M

    WaltonjenniferF

    Please let me know if anyone knows the answer for this.

    Thanks in advance.

  • Import the XML into a staging table, then the <XMLColumn>.value function to shred it into the individual columns.

    John

Viewing 2 posts - 1 through 2 (of 2 total)

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