SQL Query Execution Error

I am trying to execute a SQL query where I have to pass a parameter dynamically. I read multiple posts online where it was suggested to list the parameter as follows in the SQL query - @parameter or :parameter or ‘@parameter’. I tried all three ways but I keep getting the error saying illegal variable name/number. I also tried creating a separate string with the parameter and using the string name in place of the query. None of these methods have worked so far. I would really appreciate if someone could suggest an alternate solution to executing a query dynamically.

My query is as follows -
“SELECT MIN(CNUMBER),MAX(CNUMBER),COUNT(1),SUM(NET_AMT)
FROM I.AB
WHERE DATE = ‘parameter or dynamic input date’”

Please let me know if anyone has any thoughts! Appreciate it!

2 Likes

Buddy @Shambhavi_Gupta

Welcome to uipath community buddy.

In your statement the where clause has a keyword buddy, Date = …
Thats what shows error as invalid name
Mention it as [Date] buddy

Kindly try this and let know whether this works or not buddy
Cheers @Shambhavi_Gupta

1 Like

Thanks @Palaniyappan for the reply. I tried putting the word Date in parentheses like [Date] but I still get the same illegal variable name/number error. Any other suggestions?

buddy may i know what is this I.AB @Shambhavi_Gupta

It’s a table name @Palaniyappan