Hi All,
I have been successfully using the Execute Query activity against a SQL database without any issues and I am comfortable with how it works and using arguments to pass in parameters using the @
However, I am trying to build a robot that first builds a string variable of IDs within a loop, and as part of the loop it adds in the ’ and , characters to essentially build the following string:
List_Of_IDs = ‘ID1’,‘ID2’,‘ID3’,‘ID4’,‘ID5’,
I then use a substring on the variable to remove the 1st character and the last 2 characters. This is to format the string variable so that I can then pass it into the following SQL
Select * from databasetable where ID in (@List_Of_IDs)
I am removing the last comma and I am also removing the first and last ’ (quotation character) because I know if I just pass a parameter in normally the quotation characters are automatically added.
I don’t get any errors when UiPath runs the query but the debugger shows that there is just no results returned.
If I copy out the string built as part of the List_Of_IDs following the removal of the comma and quotation characters and run this directly in SSMS and add in the first and last quotation then I get the results I am expecting.
Is anyone able to help as I am sure this is something to do with the formatting which is passing the SQL requirements but leading to 0 results returned.