I need to move data from one MS SQL database to another. However, that destination database is a bit different. For example, a table has the same rows, but with different data types and so on. From what I read, it looks like SSIS is the tool, however, how would be the process and components from the toolbox to use for the example above? My concern is I might have to create one data flow source for each table or something like that. Anyway, what would be the less time consuming option?
Thank you!
Given that it’s a disposable task and the data volume is low, I’d use the Import/Export wizard to generate the basics of moving all those tables. You can either right-click on a database in SSMS, Tasks, Export… or just run DTSWizard.exe from the commandline/Start->Run
Either way, you’ll have a wizard walking you through a variety of screens. Most of them are self-explanatory but that never stops me from commenting.
First 2 screens define source and destination. The default of both of those of “SQL Server Native Client 10.0” is correct, simply define Source and destination server names and database/catalogs.
3rd screen accept the default of Copy data from one or more tables or views.
4th screen allows you to pick the source tables and the default for destination will be the same table and schema. If any of the tables have identity columns, you will want to click on the “Edit Mappings…” button and check the “Enable Identity Insert” option. This needs to be done per table.
5th screen is rather important. As you need to manipulate the data before it can get into the target tables, uncheck Run immediately (unless you feel lucky) and check Save SSIS Package. Save to File System, change package protection level to “Do not save sensitive data”
6th screen asks where the package should be saved to and what it should be called. I’m naming it so_Araujo and saving it to c:\sandbox\ssishackandslash\ssishackandslash\so_Araujo.dtsx Where and what you call it does not matter, merely make note of where it is.
Click Finish and review the actions. If there were any errors of the type “Failure inserting into the read-only column” make note as those were most likely missed identity inserts.
Open Visual Studio, create a new project of type SQL Server Integration Services (under the Business Intelligence section) and then right click on the project (mine’s called SSISHackAndSlash) and select Add, New Item… Select the package you created on the 6th screen and double click to open it.
The Import/Export wizard does an ungood thing of putting lots of unrelated source & destinations together in a dataflow. Since this is a one-off, I wouldn’t care so much about that vs the speed of letting the GUI add all the tables and wiring them up.
Now comes the fun of coercing data types into the right type and anything else you need done. You’ll be looking at a combination of Derived Columns Transformations and Data Conversion Transformations and then remapping the column in the destination table. If you have particular issues, sing out. I might have done a bit of SSIS 😉
An alternative solution would be to use EzAPI to script out the bulk of the data movement and then hand edit the 20% that needs to be massaged.