Page 1 of 1

Parameter

Posted: Mon Mar 22, 2010 6:48 pm
by dsconultant
Hi,
My job uses query in a parameter.

Eg: select * from personnel is #query#

Now I want to put a condition.

select * from personnel where id in ('1','2')

I want to put ('1','2') in a parameter #condition#

so I want
select * from personnel where id in #condition# to be in #query#.
But when I put a parameter inside a parameter it doesnot read the second parameter #condition# and I get an error saying "missing expression".

How can I handle this?

Posted: Mon Mar 22, 2010 8:49 pm
by chulett
You can't put a "parameter in a parameter", there's only one level of resolution for them.

Re: Parameter

Posted: Tue Mar 23, 2010 12:03 am
by krisp321
Try this

select * from personnel where id in ('#condition1#','#condition2#')

when you want to put parameters in SQL, use the single quotes in SQL level but not in parameter

so in parameter level
condition1=1 (do not put quotes here)
condition2=2 (do not put quotes here)
dsconultant wrote:Hi,
My job uses query in a parameter.

Eg: select * from personnel is #query#

Now I want to put a condition.

select * from personnel where id in ('1','2')

I want to put ('1','2') in a parameter #condition#

so I want
select * from personnel where id in #condition# to be in #query#.
But when I put a parameter inside a parameter it doesnot read the second parameter #condition# and I get an error saying "missing expression".

How can I handle this?

Posted: Tue Mar 23, 2010 4:06 am
by Sainath.Srinivasan
You can do something like

myQuery = "SELECT yourColumns FROM yourTable"
myCondition = "WHERE yourConditionColumn = 'xyz'"

and in your query defn, provide your user defined query as
#myQuery#
#myCondition#

Re: Parameter

Posted: Tue Mar 23, 2010 7:01 am
by gssr
dsconultant wrote:Hi,
My job uses query in a parameter.

Eg: select * from personnel is #query#

Now I want to put a condition.

select * from personnel where id in ('1','2')

I want to put ('1','2') in a parameter #condition#

so I want
select * from personnel where id in #condition# to be in #query#.
But when I put a parameter inside a parameter it doesnot read the second parameter #condition# and I get an error saying "missing expression".

How can I handle this?
Are you using the whole query in a Parameter, Can you tell what is your business requirement to have a query in PARAMETER?

Posted: Tue Mar 23, 2010 4:14 pm
by kduke
You can do it all in one parameter but you cannot run the job using dsjob because you cannot quote it properly. You have to start the job with another job or in Director. It gets tricky.

Posted: Fri Mar 26, 2010 10:12 am
by abhijain
Earlier I have suggested some workaround for such scenario.

Hope this will help for you.

viewtopic.php?t=131761&highlight=