Output XML to file

  • I have a really simple SELECT statement & I want the results to a file so I can schedule it to run nightly. I need to use the file in a third party app.

    My T-SQL is

    SELECT field1, Field2

    FROM MyTable FOR XML RAW, TYPE, ROOT('Inventory')

    The results are fine in a query window, but how do I get the results to a file? And also schedule it?

    I thought this would be an easy 15 minute job & have so far spent about 5 hours on it! I have scoured the internet for similar posts and most talk about SSIS which I am not entirely unfamiliar with & even though I know a little, it still has me stumped. There are articles about using XSLT translations which i don't really need - just the output directly from the SELECT is fine.

    How can something so simple be so flipping hard? Oh, any answer needs to spell out the steps so a dummy like me can understand!

    I have an Execute SQL Task. Where to from there?

  • Actually XML's are for web-services, not for file systems.

    Can you get the web-service which actually needs that XML just make a call to you procedure and grab the XML stream it will return?

    _____________
    Code for TallyGenerator

  • I disagree that XMLs are for web stuff only.

    I use them fairly often for EDI data transfer & other data transfer requirements.

    Anyway, that's beside the point. I just want my query results to a file, simple as that.

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

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