Stored procedure to create a file

  • Can someone show me how to create an XML file (on file system) by executing a SP.

    USE Northwind

    GO

    select * from dbo.Customers for xml auto

  • Depending on what you need, you can do a select * from the table.  Then using the recordset.save method, save as an xml file.

    I can't really propose the best method to you since I have no idea of what you need to do with that data.

  • I want to be able to export all data from tables into XML files and import them into the respective tables.

    So as an example,

    I want to export all the data from Northwind.dbo.Customers into Customers.xml on the file system and truncate the table and import the data back from Customers.xml file.

    I am using SQL Server 2000.

    Thank you RGR.

  • I see no point in doing that. Why do you want to do is exactly?

  • We have a testing environment (with more than 100 tables) where we want to take backup only certain information from few tables (few hundred rows, from 10 tables).

    We do a normal backup, but by taking this approach (exporting data into XML files), we can give the developers the ability to restore the data, rather than restoring the database and then restoring the data.

    I hope it was clear.

  • Check the export data wizard.  It can do just that.  You can run the wizard then save the package on the server for further use.

     

    Also if they manually want to choose the table, they might use my idea of the recordset.save as html.  Not really a fast operation but on a few 1000 rows it's good enough.  Also they would have full control over it!

  • have a look at sp_makewebtask.

     

    Rich

Viewing 7 posts - 1 through 6 (of 6 total)

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