ODBC Excel as a database using named parameters

I am using an ODBC connection to Excel to be able to run sql queries. The “Run Query” activity has a dialog to create a list named parameters. I tried syntax of “@param” in the update dml statement but get a runtime error saying X parameters required. The only way I can get the query to work is if I use the ordinal position and replace “@param” with “?”. Can anyone confirm if name parameters simply not allowed in this situation?

@Phil_Kelsey

For mssql db types we have to use ? And positional argumnets only…normal parameterization would not work

Or one more way is completely remove parameters and use the variable directly in the statement

Eg : "Select * From [abc] Where col1='" + var1 + "'"

Hope this helps

Cheers

1 Like

thanks for the confirm. I am using ordinal position to set params

1 Like

@Phil_Kelsey

Please close the topic if solved…

Happy Automation

Cheers

Hi @Phil_Kelsey

n the context of ODBC connections to Excel using the “Run Query” activity in UiPath, named parameters (e.g., @param) are not typically supported for SQL queries. Instead, you would typically use positional parameters represented by ?. This is a limitation of some ODBC drivers and Excel’s connectivity.

When you define parameters in the “Run Query” activity, you need to specify the values for those parameters in the same order as they appear in the SQL query using ? as placeholders. UiPath will map the provided parameter values to the placeholders based on their order.

For example, if your SQL query looks like this:

UPDATE [Sales$] SET Column1 = ? WHERE Column2 = ?

Thanks!!