Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering data from heterogenous sources

Status
Not open for further replies.

rickj65

Programmer
Jun 5, 2002
79
US
I have a table in an Oracle database and I need to copy a filtered set of records from that table into a SQL Server database table on a monthly basis.

The problem I'm having is that the WHERE condition that I use for filtering the Oracle table can change on a month-to-month basis based on data found in a table in the SQL Server database. For example, let's say I keep a table of vendors in a SQL Server table. This list of vendors changes each month. I want to download a list of products from a master products table in my Oracle database that pertain to the list of vendors.

How can I dynamically generate a SQL statement to run a data pump task against the Oracle database? Or is there a different way I can accomplish this?

Thanks.
 
TWIMC,

I solved my problem above by writing an ActiveX Script Task that creates the SQL string that I use in querying the Oracle database.

Within that script I dynamically build an "IN" list of vendors..."WHERE VendorID IN ('ABC', '123', 'DEF', etc.)" that I built by creating an ADO connection to the Vendors table which I loop through.

After building the entire SQL statement, I apply the SQL dynamically to the Source of the data pump task each time the package is run. Thanks to sqldts.com for explaining this here...

It works like a charm.

An alternative I could've used would be to create a Linked Server in SQL Server to the Oracle database and join the tables I need in one query. However, many people warned me about joining tables across heterogenous data sources.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top