Solved

sending parameter values into "Data Flow Task: Source SQL Command."s

Posted on 2014-11-25
6
176 Views
Last Modified: 2016-02-11
the SSIS package has many [Data Flow Task: Source SQL Command.} elements in sequence. (157 to be specific)

The source has these different kind of WHERE conditions used at the moment.

Select * from ____ where a in (,,,,,) and b in (,,,,,)
Select * from ____ where a in (,,,,,)
Select * from ____ where b in (,,,,,)
Select * from ____ where c in (,,,,,)
Select * from ____ where b in (,,,,,) and c in (,,,,,)

Right now they are all hard coded.. if I want to move them to parameter variables (SSIS->Variables), can you suggest how this can be done?

my dilemma is that

Select * from ____ where a in ? and b in ?
won't work for both
Select * from ____ where a in (,,,,,) and b in (,,,,,)
and
Select * from ____ where b in (,,,,,) and c in (,,,,,)

Thank you,
0
Comment
Question by:25112
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40465189
Give us a data mockup of what you're trying to pull off here.
0
 
LVL 5

Author Comment

by:25112
ID: 40465230
right now every query in the sources are hard coded with the values. but if the values in the hardcode is to be changed, then all 157 tasks have to be touched.
but if parameters can be used, then it should be totally customizable on a quick notice, but then the parameters are different for for 2 different tasks.. one of them has one parameters.. another has two.. but among the 157, you have only 5 kinds/types/categories of WHERE Conditions.
0
 
LVL 81

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 200 total points
ID: 40521784
place your variables at the top of the file.  http://msdn.microsoft.com/en-us/library/hh213296.aspx
and reference the parameters in your code.
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 300 total points
ID: 40521792
Hi,
are these 157 data flows reading from the same source and writing to the same targets (hence is the data flow structure identical for all of them - just the selection criteria / filter is different)?

If the answer to the above question is YES, then I would normally go that route:
- Create a table to store the filter conditions with the following columns
  a. ID
  b. Filter Name (could be handy for logging/debugging)
  c. Filter Type (for each filter type combination a dedicated value e.g. A, B, C, AB, AC,BC )
  d. FilterField A Filter value
  e. FilterField B Filter value
  f. FilterField C Filter value
  g. If necessary perhaps a SortOrder field
- Query the filter table and use a foreach loop inside the control flow to loop through each filter
- Either use an expression (using IF statements on the filter type) OR a script component to build the complete WHERE statement based on the information from the current filter record
- In the single generic data flow inside this foreach loop use a variable as data source where you use the standard select statement and the where expression you built upfront

Perhaps there are better alternatives but IMHO a quick and extendable solution.

HTH
Rainer
0
 
LVL 5

Author Comment

by:25112
ID: 40543587
thanku
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My client sends data in an Excel file to me to load them into Staging database. The file contains many sheets that they have same structure. In this article, I would like to share the simple way to load data of multiple sheets by using SSIS.
A couple of weeks ago, my client requested me to implement a SSIS package that allows them to download their files from a FTP server and archives them. Microsoft SSIS is the powerful tool which allows us to proceed multiple files at same time even w…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question