SQL query how to split xml into seperate xml's

  • Hi All,

    I am facing problem ..where i generate xml file out of SQL table data ..format like..

    A

    B

    1

    2

    3

    C

    D

    2

    3

    4

    ..i want 2 seperate xml file from this one xml depending on head..

    i.e for one head there should be one xml ..

    pls suggest some solution..

    Thanks

    sandeep

  • Try querying the XML the usual way, return the results as a standard set, then use For XML to turn the sub-results back into XML. Will that work for you?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • GSquared (5/1/2008)


    Try querying the XML the usual way, return the results as a standard set, then use For XML to turn the sub-results back into XML. Will that work for you?

    Hi..

    Thanks for reply..

    i am using FOR XML AUTO,ELEMENTS at the end of query..this query depends on some relation between two tables..to make one xml..

    so is there any way i can seperate xml depnding on heads...

  • There is a great XML series on this site by Jacob Sebastian. You might want to check it out and see if there are techniques in there that can help you.

    http://www.sqlservercentral.com/Authors/Articles/Jacob_Sebastian/212008/

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

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