need to format sql query output in physical xml output file

  • Hi,

    This is what I have written in query editor(sql server 2008):

    select wmwhse1.SKU.SKU from wmwhse1.SKU

    FOR XML PATH ('Item')

    :OUT C:\Users\sa\Desktop\test2.xml

    Output file contains this:

    XML_F52E2B61-18A1-11d1-B105-00805F49916B

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    <Item><SKU>ITEM01</SKU></Item><Item><SKU>ITEM02</SKU></Item><Item><SKU>ITEM03</SKU></Item><Item><SKU>ITEM04</SKU></Item><Item><SKU>ITEM5</SKU></Item><Item><SKU>ITEM007</SKU></Item><Item><SKU>RPG000A01</SKU></Item><Item><SKU>RPG000A02</SKU></Item><Item><SKU>RPG000A03</SKU></Item><Item><SKU>IPHONE</SKU></Item><Item><SKU>PHONE1</SKU></Item><Item><SKU>ITEM123</SKU></Item>

    (12 row(s) affected)

    But I want only the xml part in the output file(first <Item> to last </Item>). How do i do it? Please help.

    Thanks in advance.

  • FOR XML RAW (''), ELEMENTS , ROOT ('Item') ?

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

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