Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Pass Record as Parameter from Sql Server to Oracle Server Expand / Collapse
Author
Message
Posted Friday, September 6, 2013 4:45 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, July 14, 2014 11:18 AM
Points: 2, Visits: 9
Hello,
Can you please tell me how i can accomplish the following:

I have a list of IDS which i extract from SQL Server 2008 table , which i want to pass in a query (it's a big monster with quite a lot of inner, outer joins). I'll use the query to extract the records from Oracle Server and save back to Sql server.

I'm using Ole Db source.

Please let me know if you need more details to provide a possible solution

Thanks a lot
Vik
Post #1492155
Posted Friday, September 6, 2013 5:02 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:42 PM
Points: 13,239, Visits: 11,018
You can create a string variable in SSIS containing your SQL statement. Just add the IDs you extracted to this variable using an expression.

In the OLE DB Source, use the string variable as a source for the SQL statement.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1492158
Posted Friday, September 6, 2013 10:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, July 14, 2014 11:18 AM
Points: 2, Visits: 9
Thanks Koen,
This is what i did until now:

Data Flow Task (DFT1) : Used Ole Db Source to extract all the Ids and Save them in a Recordset destination. Used variableZ as Object here

Link the DFT1 to a Foreach Loop Container. "Foreach Ado Enumeration"
Enumeration mode: ROws in the first table.
Variable mapping : VariableY= 0 ( It's defined as string)

Inside the foreach loop i have another DFT2 and Ole DB Source data Access mode = SQl command from variable. I built the expression to grab the SQL QUery + The ID coming from the FOreach loop , one by one.
The problem is that the last output result is exporting only 1 record.

Note that i can have more than 10000 Ids to pass in the query.

I can't pass all of then in the query at once, since in oracle i can put only 999 Ids.
And the ids should be in quotes like

WHERE ID IN ( 'ID1','ID2','ID3','IDnth')

Thks advance,
Vik

Post #1492330
Posted Monday, September 9, 2013 3:20 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:42 PM
Points: 13,239, Visits: 11,018
Wouldn't it be faster to transfer everything to SQL Server and then delete everything you don't need?



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1492702
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse