English 中文(简体)
ssis sql server 2008 for access .mdb database
原标题:

I want to know how to import .mdb (MS Office 07) file into Sql server 2008 by SSIS. I need to run this ETL packet in such a way that it checks for duplicates, and if any doesnt re-insert them, but only inserts new records. If someone has a tutorial link or can explain here in steps would be very helpful

问题回答

Expanding on HLGEM s answer...

  1. In SSIS create a new Database Flow object and enter into that section (second tab on top).

  2. Create a OLE DB Source object (may be a specific one for Access but the basic OLE DB Source should work) and pick Access as your source and find your .mdb file. Without getting really descriptive it should find the columns and you can format it a little bit to skip headers rows, etc.

  3. Next, create an OLE DB Destination component by dragging it onto the screen and connect the green arrow from the source to it. Open that destination component up and chose to create a new database. It should automatically make column names and assign their types based off of your .mdb database. In this section you can specific which columns you d like to be keyed which will denote the unique rows as you wanted. If you don t have any fields to go by you will have to explore other options after (see HLGEM s post). If you do have a field you can key on, do so.

  4. Now that you have this created you can specify how you want your error output to be handled on the OLE DB Destination...If you choose redirect and push the data to a file all your duplicate keys will be thrown in there.

Hope this brief summary helps!

This is a bit extensive to discuss in a forum like this, but...

Generally I do this by importing the data to a work table (not the one you want the data to end up in). It should also have it s own identity column (Useful for separating out duplicates within the data) and a column for your database table record id. Hopefully the data has some type of id field for each record. If it does, then you should have a mapping table that links the datbase ids from your database to the record ids from the Access database. Then it becomes a simple matter of looking for the ids that don t exist in the mapping table and inserting the records associated with them your the production table you are putting the information into. Usually when I do this I add my own id field to the work table and then I insert those records into the mapping table as a final step.

If the data you are receiving has no id field, this is much harder and may be impossible depending on the nature of the natural key or even if you have one (Access databases often being notorious for not following database design principles). If the closest thing you have to a unique identifier is the name/address combination how do you know if John Smith at 10 State Street in Chicago IL is the same person as John Smith at 25 Main Street Chicalgo , IL. He could have moved or it might be a differnt John Smith.





相关问题
Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

access query to filter and combine count

i have two access tables tableA num count 1 7 2 8 3 9 4 9 5 13 6 6 tableB num count 0 1 1 14 2 12 3 5 4 5 5 11 6 5 how can i create an access query that ...

How to show File Picker dialog in Access 2007?

I want to show a dialog where the user can pick a file, click OK, and then the path to the file will be saved in the database. I have just one problem, I can t figure out how tho show the dialog ...

MS Access: list macro from VBA

I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by ...

Returning row number on MS Access

I have 4 tables, from which i select data with help of joins in select query...I want a serial no.(row number) per record as they are fetched. first fetched record should be 1, next 2 and so on... In ...

热门标签