cancel
Showing results for 
Search instead for 
Did you mean: 

List of values as Param for Query template

Former Member
0 Kudos

Hi All,

I am using Fixed Query as blow.

Select username from users where userid in (1,2,3,4,5,6);

Select username from users where userid in '[Param.1]'

I am setting Param.1 = 1,2,3,4,5,6 but it is not working.

Could you please help me to solve the issue?

Regards,

Sachin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sachin,

I am using a list and an IN clause with SQL Server like this:


select security_assignments_vw.security_token, security_assignments_vw.security_token_type
from security_assignments_vw 
where security_assignments_vw.security_role in ([Param.1])

the value in Param.1 is actually the IllumLoginRoles which in the case of my user id is:

'XMII Developers','XMII Administrators','XMII Users','XMII Managers','XMII Operators'

Note the single quotes around each value as the roles are in a varchar column.

If your user ids are also varchar values, the SQL would require single quotes

around the values like this: '1','2','3','4','5','6'

What is the error you are getting?

Hope this helps,

--Amy Smith

--Haworth

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

Just on the face of it, you are missing the parentheses. It should look like:


Select username from users where userid in '[Param.1]'

and Param.1 should be (1,2,3,4,5)

or perhaps


Select username from users where userid in ([Param.1])

and Param.1 should be 1,2,3,4,5

Test it but the end result of your script needs those parentheses.

Good luck,

Mike