where clause condtion as a variable (SSIS 2005)

5 pts.
Tags:
SSIS
SSIS 2005
WHERE condition
 
Let's say we have this query
 
select * from customer
where customerid = '1'
 
My question is can we create this "customerid = '1'" condition as a variable in SSIS and once it becomes a varible then I will extract the conditions for a column in table,


Software/Hardware used:
SSIS

Answer Wiki

Thanks. We'll let you know when a new response is added.

try using dynamic sql in a stored procedure. Something like this:

declare @sql varchar(1000)
declare @tablename varchar(100)

set @sql = ‘SELECT * FROM ‘
set @tablename = ‘database.schema.tablename’
set @sql = @sql + @tablename

exec ( @sql )

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Kccrosser
    If there are a finite number of where clause conditions, the simplest method is to use a control variable to choose the condition of interest at run time. Note that this is NOT necessarily an efficient way to run the query, but is very easy to implement. ... where (conditionselector = 1 and {this condition clause}) or (conditionselector = 2 and {this condition clause}) or ...
    3,830 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following