I am using SSIS package to read the data from Access file and import them to SQL Server table. I have total 10 tables that I need to migrate / import to SQL Server. I am using OLE DB Source & OLE DB Destination tasks for this requirement. SSIS Package is working fine and perform the required tasks.
I am using OLE DB Source task to read the data by providing following:
OLE DB Connection Manager: AccessDB Connection
Data access mode: Table or View
Name of the table or the view: tableName
Now, I need to add one more table but it may not present in all the accessdb (mdb) files. Because of table is not present, OLE DB source task throws an error but I would like to ignore that error, insert default data to SQL Server table and go ahead with other tasks.
How can I achieve this functionality in SSIS package?
I can suggest a way in outline, at least.
1) Create a package-scoped variable (TableExists, or similar) - make it a byte or small integer.
2) Create an ExecuteSQL task which 'points' to the Access database.
a) (I'm a SQL Server guy, so this is the bit you'll need to expand on) Write a query to return 1 if the table exists, 0 otherwise.
b) Return the results of the query to the variable created in (1).
3) After your ExecuteSQL task, create a precedence constraint to the data flow task for the table which may or may not exist.
a) Change the Evaluation operation to Expression and Constraint.
b) Set the Expression to something like
c) Create another precedence constraint from the ExecuteSQL task which skips the data flow task. Its Expression will be something like
Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this
If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.
Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.