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

Paramerters on DataFlow Task Expand / Collapse
Author
Message
Posted Tuesday, February 26, 2013 10:15 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, February 18, 2014 5:22 PM
Points: 58, Visits: 197
I have a scenario , where I need to fetch data from Database 1 (on Server 1) and insert into Database 2( on Server 2) on a particular condition.

I am using SSIS 2008.

1)First I fetched an ID from Database2 using ExecuteSqlQuery.

2)I then used the ID from step 1 and fetched a set of rows from Database1 again using another ExecuteSqlQuery

3) I now want to insert these fetched rows back into Database2.
I guess I should probably use a for each .

But.... I now feel that it is better that I use a Data flow task in
step 2 .
I know there is a way to pass parameters(id) using executesqlquery , but I cannot find a way to pass the the output of the execute sql task as an input to the data flow task . Is it possible ? Is there a better way to do what I am trying to achieve ? Please let me know.

Thanks,
SA
Post #1424167
Posted Tuesday, February 26, 2013 10:41 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:23 AM
Points: 5,074, Visits: 11,852
sameerarjuna (2/26/2013)
I have a scenario , where I need to fetch data from Database 1 (on Server 1) and insert into Database 2( on Server 2) on a particular condition.

I am using SSIS 2008.

1)First I fetched an ID from Database2 using ExecuteSqlQuery.

2)I then used the ID from step 1 and fetched a set of rows from Database1 again using another ExecuteSqlQuery

3) I now want to insert these fetched rows back into Database2.
I guess I should probably use a for each .

But.... I now feel that it is better that I use a Data flow task in
step 2 .
I know there is a way to pass parameters(id) using executesqlquery , but I cannot find a way to pass the the output of the execute sql task as an input to the data flow task . Is it possible ? Is there a better way to do what I am trying to achieve ? Please let me know.

Thanks,
SA


Your step (2) needs to change.

Add a dataflow task and a suitable OLE DB source component.

Change your data access mode to 'SQL Command' and type in your query, mapping your ID as a parameter.

You now have the rows you wanted, retrieved as the first part of your dataflow.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1424180
Posted Wednesday, February 27, 2013 3:44 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, February 18, 2014 5:22 PM
Points: 58, Visits: 197
Great ! Thank you !
I did as you said !
Works for me !

Post #1424798
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse