xml file content appears in one long row

  • for exporting to xml file i use:
    bcp "select * from table'" queryout C:\filename.dat -S @@servername -t -c -C 65001 -T
    the result in the created file appears in one long row like:
    "<Payment_group><Payment>100</Payment><PayMonth>201301</PayMonth></Payment_group>"

    how can i force it to appear in separate rows like: 
    "<Payment_group>
    <Payment>100</Payment>
    <PayMonth>201301</PayMonth>
    </Payment_group>"

    thanks ahead

  • Duplicate of post https://www.sqlservercentral.com/Forums/1854197/export-to-xml-file-with-separate-rows. Please keep to one topic per question.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • sam-433147 - Friday, February 3, 2017 9:44 AM

    for exporting to xml file i use:
    bcp "select * from table'" queryout C:\filename.dat -S @@servername -t -c -C 65001 -T
    the result in the created file appears in one long row like:
    "<Payment_group><Payment>100</Payment><PayMonth>201301</PayMonth></Payment_group>"

    how can i force it to appear in separate rows like: 
    "<Payment_group>
    <Payment>100</Payment>
    <PayMonth>201301</PayMonth>
    </Payment_group>"

    thanks ahead

    Open Analysis Services XMLA Query window from SSMS and paste your XML code. You will get the same what you are looking for, See below screen shot.

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

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