Page 1 of 1

Passing Query Output as parameter

Posted: Tue Jan 03, 2012 12:51 am
by abhilashnair
How can I pass output of a SQL query as parameter in a job

Posted: Tue Jan 03, 2012 2:14 am
by BI-RMA
In a Server-Job You can use a Server-Routine to overwrite the UserStatus-variable. The resulting string can be used for succeeding jobs within a sequence. If the query returns several columns You have to format these as a single delimited string.

There is no direct way to pass the result of an SQL-query to a job as a parameter.

Posted: Tue Jan 03, 2012 2:21 am
by soumya5891
prepare a shell script with that query.Put the output of the sql into an variable.And then echo it.Now using a user activity stage in sequence job you can retrieve the result.Now you can pass that as a parameter.Hope this will work.

Posted: Tue Jan 03, 2012 2:44 am
by ray.wurlod
Is this a query that is guaranteed to return precisely one row? If so, what you seek can be done by using a server job to execute the SQL statement and load its output into the job's user status area whence it can be retrieved downstream in the controlling sequence via the Job activity's $UserStatus activity variable.

Re: Passing Query Output as parameter

Posted: Tue Jan 03, 2012 7:31 am
by chulett
abhilashnair wrote:How can I pass output of a SQL query as parameter in a job
It would help if you clarified what exactly it is that you are asking. This SQL output and 'parameter' - are you speaking of the same job that is running the sql? Or another, downstream job?