Page 1 of 1

Pass values from file to WHERE clause in query

Posted: Thu Sep 10, 2009 6:01 am
by pratyusha
I have a flat file which has some 20 values in it. I have to run a query for these 20 values. So these values need to come into a WHERE clause. I have searched the forums to check for an answer but I am not able to find one. Is this approach possible? Can any one please suggest some ideas?

These values would be updated everyday. So I run a job to load the values into the flat file and then run another job with these new values.

Thanks
Prathyusha

Re: Pass values from file to WHERE clause in query

Posted: Thu Sep 10, 2009 6:33 am
by sachin1
your operating system is unix as you mentioned so it will be great that you create one more file which will have just one single record from your file which is having 20 values and use this file having single record for your lookup condition.

you can create a single record from file havig 20 records in your before job subroutine.

Posted: Thu Sep 10, 2009 6:44 am
by pratyusha
Can I pass these values as a parameter to the job?

Thanks
Prathyusha

Posted: Thu Sep 10, 2009 7:03 am
by priyadarshikunal
Yes. Give it a shot.

Posted: Thu Sep 10, 2009 7:14 am
by pratyusha
Thanks for your patience but how to pass it as parameter to DS job..

Posted: Thu Sep 10, 2009 7:15 am
by Sainath.Srinivasan
You can.

Do an executeCommand to cat the file into a variable and pass it as a parameter.

If it is characters, it will be tricky to add quotes around.

Alternatively do a before job work to include your SQL and cat the 'where' to form a new SQL file and use it in the query.

Posted: Thu Sep 10, 2009 7:36 am
by pratyusha
Thanks for your prompt reply. It is not characters and just numbers so that is fine.
But will DSSetParam work from Before/After subroutines

Posted: Thu Sep 10, 2009 7:41 am
by chulett
NO. That's too late as the job has already started. You need a Sequence job to gather the values and then pass them in to the Job Activity stage to run the job.