Saving XML Query Results in a Directory from SQL Server 2008

  • I've written a query that will go through several records and create XML file for each record. I'd like to be able save the XML file in a directory. What is the best way to achieve this task?

  • If I understood you correctly, I have done this by putting the XML file in a table and BCP that out to the file. The directory can be loaded from a control table too if it needs to be changed from time to time.

  • While you certain can use BCP - depending on where the folder happens to be, you end up having to get messy with user security. For that reason - I would look at using SSIS (this is the kind of thing SSIS is written to do).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Matt, good point. The approach very much depends on their setup and security tolerance. I used BCP in my more SSIS resistent days.

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

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