I am assuming that you have set up your connection correctly using “Connect to DB” activity. The “Execute Query” activity takes the output of “Connect to DB” activity
"Connect to DB" ---> "Execute Query"
UiPath has a strict syntax requirement for parameters in the “Execute Query” activity (only takes String expressions).
If your StoredProcedure takes in one parameter
Parameter for StoredProcedure =
Variable from UiPath =
inputAccountNumber → Set this as Input to Execute Query
(Mind the quotes)
The following expression is to be used in the Execute Query → Sql (as Input)
"exec YourStoredProcedure @YourRequiredParameter="+"'"+inputAccountNumber+"'"
If your StoredProcedure takes multiple parameters
"exec YourStoredProcedure @YourRequiredParameter="+"'"+inputAccountNumber+"'"+","+"@YourRequiredParameter1="+"'"+inputAccountNumber1+"'"
You will have to explicitly cast the string you send from Execute Query to the datatype in your database. For example, if
@YourAccountNumber is of integer type, you will have to edit the stored procedure to take string input and later when SQL executes the query in DB to cast the string parameter to integer and execute the query.
We have used this approach with upto 5 parameters and the Execute Query activity performs great on an onpremises database.
Hope this helps you and others.