I've spend the better part of a day looking around for anything to help me, but SSIS
is such a huge tool that nothing is of any use so far, or maybe I just don't understand it.
I need to take an old Access db that has some problems and move it into SQL server. I already have the schema set up in my SQL db. The old data needs to be fixed up, things like normalization and removing duplicates. My boss insists on using SSIS
for this job, because we need someone here who knows how to use it, and currently almost no one does (one manager used it a long time ago).
So, I have a project set up in BDIS, or visual studio, or whatever this app actually is. I created a connection manager to my Access db, and I managed to drag an OLE DB Source onto the designer and set it up to connect to that db. I also figured out that I can select data from there.
Now what? I'd really prefer to have a way to just write a giant SQL script to grab all the data I need from the Access db, transform it how I want, and shove it into the SQL server database. But it looks like I'll need to use all these funky transformation tools in the designer. I also can't figure out how I'll get the resulting data into SQL server. I have the connection set up in the Server Explorer pane, but everyone online says never use the SQL Server Destination. So I'm lost there as well.
My boss said the Books Online help files would be very useful. So far, it's been like finding a needle in a haystack submerged under a swamp, with three castles sitting on top of it. There's just too much information, and none of it seems useful to me.
Edit
Hopefully some more information will be useful. I think the wizards that come with SSIS
aren't powerful enough for what I want, so if they are, you'll have to please explain it. Here's an example of what I have to do, except my reality is a lot more tables with more transformations.
Say I have a source table that looks like this:
Companies
====================================================
| Name | Address | WidgetOne | WidgetTwo |
|--------------------------------------------------|
| ACME | 123 etc. | Trampoline | Cannon |
====================================================
I need to normalize this into two tables. And it will obviously have to track the IDs so that the widgets are associated with the correct company. If you could help with an example of how this case would be handled with SSIS
, from Access to SQL server, then I can probably take it from there. Thanks!
This might help:
You'll need connection2 to you source and desination database. It sounds like you already have your source.
You'll need a data flow task in the 'Control Flow' tab. Drag one of these on and double cli ck - you'll be taken to the 'data flow' tab.
here add a 'data source' (which it sounds like you have done) and also add an 'OLE DB Destination'.
Double-click your source. You shoud be able to specify the connection (again it looks like you've done that),
'Data Access Mode' specifes how you want to retrieve the data. I.e. straight from a table, or write a query that returns the data
if it is a straight one-one mapping to the destination, you should be able to connect the two with a the green line (a precidence constraint).
If you want to do any transformations then you can do so in the query on the soruce, or put one of the transformation obejcts in between the source and destination and connect them accoringly.
Following example probably might give you an idea to perform data migration from MS Access to SQL Server. The example uses
MS Access 2010
andSQL Server 2008 R2
database. The package was written inSSIS 2008 R2
. Unlike the previously provided solution, This answer doesn't use the SQL Server Import and Export Wizard and the package was built from ground-up.Step-by-step process:
Let's assume that the Access table is as shown in screenshot #1 with a table named
Companies
containing two rows in a de-normalized fashion.And also assuming that the table structure in SQL Server is as shown in screenshots #2 and #3 with two tables named
dbo.CompanyInfo
anddbo.WidgetInfo
. Create table scripts are provided under SQL Scripts section. The tables are empty as shown in screenshot #4.Create a new SSIS package. On the SSIS package, right-click on the connection manager and select New OLE DB Connection as shown in screenshot #5. On the Configure OLE DB Connection Manager, click New... button as shown in screenshot #6.
On the Connection Manager, select
Native OLE DB/Microsoft Jet 4.0 OLE DB Provider
and provide the Access file path. In this example, I have the file inC:\temp\Source.mdb
. Click OK. Refer screenshot #7. On the Configure OLE DB Connection Manager, click OK as shown in screenshot #8. Change the connection manager name to AccessDB (the name could be anything of your preference). Refer screenshot #9.Again, right-click on the Connection manager and select New OLE DB Connection as shown in screenshot #10. This time we are going to create a connection string for SQL Server. Select Native OLE DB\SQL Server Native Client 10.0 and provide the Server name and database name as shown in screenshot #11. Rename the connection manager to SQLServer (again, name is your choice). Refer screenshot #12.
On the SSIS package's Control Flow tab, place a Data Flow Task and name it as
Populate CompanyInfo
. Double-click on the data flow task to switch to the Data Flow tab. Within the Data Flow Task, place anOLE DB Source
, aDerived Transformation
and anOLE DB Destination
as shown in screenshot #13.NOTE:
You need to configure the tasks one by one in the order shown. Don't place all the tasks at the same time and try to connect them.Configure the OLE DB source to read the Access database table as shown in screenshots #14 and #15. Configure the Derived transformation to convert the string text from Access database to Unicode as shown in screenshot #16. Configure the OLE DB Destination to insert the data into SQL table as shown in screenshots #17 and #18.
Go back to Control Flow tab and place another Data Flow Task as shown in screenshot #19.
In the second data flow task, we read the same Companies table in Access database and try to populate the WidgetInfo table in SQL.
Place an
OLE DB Source
to read the Access table and configure it as hown in screenshots #20 and #21. Place aDerived transformation
to convert the string to Unicode as shown in screenshot #22. Place aLookup transformation
to fetch the CompanyId based on the name and address and configure the task as shown in screenshots #23 and #24. Lookup task by default will fail if it can't find a match. We need to normalize the Widget data. So, place anUnpivot transformation
and configure it as shown in screenshot #25. Place anOLE DB Destination
to insert the data into SQL and configure it as shown in screenshots #26 and #27. Second data flow task would be as shown in screenshot #28Screenshots #29 - #31 show sample package execution.
Screenshot #32 shows data in the SQL tables after the package execution.
I hope that this should give an idea of exporting data from Access database to SQL server. You can group the tables in Access and load them within a single data flow task. If there are tables depending on other tables, then you can place the in separate data flow task as demonstrated in this example.
Hope that helps.
SQL Scripts:
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
Screenshot #5:
Screenshot #6:
Screenshot #7:
Screenshot #8:
Screenshot #9:
Screenshot #10:
Screenshot #11:
Screenshot #12:
Screenshot #13:
Screenshot #14:
Screenshot #15:
Screenshot #16:
Screenshot #17:
Screenshot #18:
Screenshot #19:
Screenshot #20:
Screenshot #21:
Screenshot #22:
Screenshot #23:
Screenshot #24:
Screenshot #25:
Screenshot #26:
Screenshot #27:
Screenshot #28:
Screenshot #29:
Screenshot #30:
Screenshot #31:
Screenshot #32: