Variable of SQL statement in the Expression Editor

Hello everyone,

When I put variables into the SQL statement I wrote to execute the query, it works fine after v2022.12.0.
In v2022.10.4 it doesn’t give an error, but the variable values are not being given.

Who can tell me how to write a variable in SQL statement for v2022.10.4.
Thanks in advance.

@zhen_gu

Whatever you did looks correct…give a space after the single quote and before and …

Also another way would be to add input parameters and link the variables to those parameters…

Also whenever you edit the sql statement make sure you click on plus and then click on advanced editor and edit your variables and statement in there

Cheers

@Anil_G
Thank you for your quick response.

Yes, there should be a space after the single quote and before “and”. I have added the space.
Also, I always use the advanced editor to edit the statement.

However, the statement still doesn’t work in v2022.10.4. If the statement is correct or there is no difference in putting variables in the SQL statement from v2022.10.4, maybe I should consider whether there are any other problems in the previous steps.

@zhen_gu

Better use a log message and check if all the details are proper…

And also what exact error are you getting…we can check from
There

Cheers

Hi @zhen_gu,

You can refer to this answer. It is for stored procedures but you can also use similar approach for a SQL query as well.

@jeevith @Anil_G
Thank you for your kind reply.
I have to go outside now, but I will let you know the progress after I try it again later.

1 Like