Solved

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

Posted on 2014-11-25
6
183 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 66

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 82

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

624 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