Wednesday, March 28, 2012

Script to transfer data

I need to have .sql script for moving data from one database to another. I managed to create a script that creates the tables and also have a.sql for all the procedures, but it appears the wizard doesn't spit out anything for moving that data...what is the easiest way to populate these tables once I run the tables.sql script generated by the wizard.have you tried using the DTS Import/Export wizard ?

hth|||that would seem the logical thing to do, however I need to generate a stored proc that moves a table and its data from one Database to another. So that it is run without having to use DTS. Any ideas?|||Depending on how much data it is, you can use cursors to build SQL scripts that insert all the data. It works fine when you have a limited amount of data such as a few master records that are needed to get it up and running. If you're doing something on the scale of trying to restore an existing database, it's not an option.

Basically, use cursors to loop through the tables/data you need and dynamically build a string that will be a bunch of insert statements. Again, only good for small amounts of data.

No comments:

Post a Comment