Search This Blog

Wednesday, February 27, 2013

Simple step by step process to import MS Access data into SQL Server using SSIS


Problem

Sometimes we need to import information from MS Access. We could use the Microsoft SQL Server Migration Assistant, but sometimes we need to add custom transformations and it is necessary to use more sophisticated tools. In this tip, we are going to walk through step by step how to migrate a MS Access table to SQL Server using SQL Server Integration Services (SSIS). The tip assumes that the readers have none to little experience with MS Access and SQL Server Integration Services (SSIS).

Solution

Requirements

This example is using SQL Server 2008 R2, but it should work with SQL 2005 and SQL 2008 as well. You will need to have SSIS and MS Access installed.

Getting Started

In this demonstration we are going to create a Table named Customer in MS Access and then import the table to SQL Server using SSIS.
  1. Let's start the MS Access. Go to the Windows Start Menu > All Programs > Microsoft Office and click Microsoft Access 2010

    Iniciar MS Access
  2. In Microsoft Access 2010, click the Browse icon.
     
    Browse the file
  3. In the File New Database, specify the file name and the path. In this instance the file name will be customer.accdb and it will be stored in the c:\ drive and press OK.
    New Database
  4. In Access, press the Create button. 
  5. In the second column double click in the header and type FirstName. 
  6. In second row enter a First Name.
     
    Create a table
  7. Add some more data to the table.
     
    Add data
  8. Press the Save icon and in the Save As Window, type Customer and press OK.
    Save as the table
  9. You have just created an Access Database named customer.accdb with a table named customer. Close MS Access. 
  10. Let's start the SQL Server Business Intelligence Development Studio to import the table into SQL Server. Go to the Windows Start > All Programs > Microsoft SQL Server 2008 R2> SQL Server Business Intelligence Development Studio.
     
    Open the Development Studio
  11. In the Business Intelligence Development Studio, select File > New > Project
     
    Open the new project
  12. In the New Project Window, select Integration Services Project and specify a name and location for the project.
     
    Create a SSIS project
  13. From the Toolbox, drag and drop a DataFlow Task to the Design pane. 
  14. In the design pane double click the DataFlow Task.
     
    Drag and drop the Datataflow
  15. In the Data Flow tab, drag and drop a OLEBD Source and Destination to the design pane.
     
    Data Flow tasks
  16. Click on the green arrow and drag it to join the OLEDB Source and Destination.
     
    Join the Data flow tasks
  17. In the OLE DB Source Editor window, press the New... button to create a new connection.
     
    OLE DB Source Editor
  18. In the Configure OLE DB Connection Manager, press New... again.
     
    Configure OLE DB Connection
  19. In the Provider combobox, select Native OLE DB\Microsoft Office 12.0 Access Database Engine OLE DB Provider. 
  20. In the Server or file name type the path of the Access database. In this example it is in the c:\Customers.accdb (verify the step 3 to review). 
  21. Check the Blank Password option and press OK.
     
    Add the connection manager data
  22. In the Configure OLE DB Connection Manager, press OK 
  23. In the OLE DB Source Editor, in the Name of the Table or view select the table created in Access (created in step 8).
     
    Add the OLEDB Source Editor data
  24. Double click the OLEDB Destination.
     
    Double click the OLE DB Destination
  25. In the OLE DB Destination Editor Window, in the OLE DB connection manager, press the New... button.
     
    OLE DB Destinatio properties
  26. In the Configure OLE DB Connection Manager, press New...
     
    Configure OLE DB Destination Connection
  27. In the Connection Manager make sure that the Provider combobox is using the Native OLE DB\SQL Server Native Client 10.0 
  28. In the Server name, type the SQL Server Name. 
  29. In the select or enter Database Name, select the SQL Server database where you want to store the Access data and press OK. You can choose any database. In this instance, a database named test is used.
     
    Destination Connection Manager Properties
  30. In the OLE DB Destination Editor Window, go to the Name of the table or View combobox and press the New... button.
     
    OLE DB Destination connection Editor
  31. In the Create Table, type this and press OK:
     
    CREATE TABLE [Customers](
    [ID] int,
    [FirstName] nvarchar(255)
    )
    

    Create destination table
  32. In the OLE DB Destination Editor Click on the Mappings page and press OK.
     
    Map the columns
  33. Now the project is ready to start importing the data from MS Access to SQL Server. Now, press the start debugging icon to start importing the data.
     
    Run the start debugging
  34. To verify that everything worked, open SQL Server Management Studio and verify the data is in the database used for the import. In this case, the test database was used (verify this from step 29). 
  35. Finally query the table to verify the data was successfully imported.
     
    Verify the imported data
  36. Congratulations! You have created an SSIS project to import data from MS Access to SQL Server.

Next Steps



Last Update: 5/8/201

No comments:

Post a Comment