Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Union All with sources that occasionally do not ex

Author  Topic 

Shane_Immelman
Starting Member

2 Posts

Posted - 2010-08-20 : 05:10:46
Hi,

I am using an SSIS package to draw data from a DB2 database via an ODBC connection.

There are 8 source files/tables that have identical columns and datatypes.

Using a 'Union All' transformation I am able to join all the data together into one table.

The problem I have is that occasionally one or more of the source tables may no longer exist, and at a later stage may then exist again.

I essentially need the package to still succeed with the remaining tables without needing my intervention to remove the datareader source for the non-existent table.

One solution I had in mind is to use script components to check if each table exists before attempting to draw data from it. I have done this previously but only with local tables on SQL Server and not DB2 tables on an external server.

Any ideas on how to approach the problem will be greatly appreciated.

Shane_Immelman
Starting Member

2 Posts

Posted - 2010-08-20 : 07:34:39
My solution is as follows:



I have realised that I am able to access the DB2 source tables via a linked server.

There is never more than a handful of records in each of these tables so the performance of the linked server is not much of an issue.

Before I attempt to extract data from each source I include a script task that checks whether the table exists.

If it exists the 'success' constraint carries the flow on to extract the data.

If the source table does not exist, then the 'failure' constraint bypasses the extraction of data from that source.
Go to Top of Page
   

- Advertisement -