Copy data to update schema database

  • I have a situation. I have a software application that creates a new database on install. But I already have an older version of the application on another server that I need to copy data from. :unsure: The new version may create some new tables and even populate them with control information for new features. It may also add columns to existing tables. I need a way to "merge" my data from the old database tables into the new database tables (separate database on the same server). So I need a way to map the matching columns and insert the data. Is there a script I can use to do that? I can do heavy VBScripting of database work but am not so hot at T-SQL stuff.

  • Check out RedGate's SQL Data Compare tool @ http://www.red-gate.com

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I was hoping for a simple VBScript that would list all the tables in an array, then list all the columns and attributes and build an insert statement and write that to a text file.

    Then I could just execute the text file (as SQL) on the target server. This is similar to what MySQL can do in scripting output.

    This is one-time shot. I won't need it again.

  • If you're just looking for an SQL script with all data in a database scripted out as DML commands (similar to what mysqldump can do) you can get that from the SSMS "Generate and Publish Scripts" functionality. Connect to the source database in SSMS, right-click your database and go to Tasks > Generate and Publish Scripts. There are lots of options. MySQL is a bit *stronger* on the simplicity-scale than SQL Server if that makes sense so you may have to play around with the options until you get exactly what you want.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • That will work! Thanks so much for the response.

  • You're very welcome 😀

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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