Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Pass Record as Parameter from Sql Server to Oracle Server


Pass Record as Parameter from Sql Server to Oracle Server

Author
Message
sk80rb0i
sk80rb0i
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 12
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
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16441 Visits: 13202
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 SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
sk80rb0i
sk80rb0i
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 12
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
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16441 Visits: 13202
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 SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search