Exceute sql query to select id column by its name as string variable

I want to access the id of a particular name by using sql query. ie inside execute query activity, I use the query as : “select id from employee where name=‘aaa’”. by using this query I get the result. But when I need to access the id of a person whose name is stored in string variable.

ie name = “aaa”
now I need to write query whith variable name.How to write the query anyone please help me?

Hey @rifnanahas

"select id from employee where name='" + yourStringVariable + "'"

It should work.

1 Like

@rifnanahas - You can try use ‘@parameterName’ statement in the sql command.
select coulmns from @table where column = @parameterName

For best practices - you can refer : https://docs.uipath.com/activities/docs/execute-query

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.