Stored proc


We are trying to migrate all our codes from AA to UI Path. I’m having a hard time running a stored proc.

Procedure name: usp_GetPreviousBusinessDate with parameters (‘ON’,’Date’)

Can you please advise me how to use activity Execute Query activity in this case or is this the right one?

Thank you in advance

I guess you should use activity ExecuteNonquery


1 Like

welcome to uipath community
we can use EXECUTE QUERY activity
where in the property panel
–mention the connection string and ensure whether connection is made with TEST CONNECTION option in connection wizard
–then CommandType property mention as STORED PROCEDURE which willI nvoke
the procedure name specified in the SQL parameter.

–then SQL property mention the sql command and this field must be completed according to the selection from the CommandType property.

and finally mention the parameters with IN direction we want to pass with while in the sql command we can use that with @parametername

for more info on this. document from uipath would help you

Cheers @Planteigne

1 Like

Thank you for your reply.
The result of the stored proc I posted is this “2019-09-11 00:00:00.000”, it’s in row 1 and no Column name.

on my Execute SQL activity, I have below.

“usp_GetPreviousBusinessDate ‘ON’,’”+vCurrentDate+"’’" . I assigned DateTime.Now.ToString(“yyyy-MM-dd”) to vCurrentDate.

Is this right? I can’t seem to get the result in UIPath. My DB connection is showing successful.
And how do I get the result to show in a message box and saved to a variable?

Sorry, I have very minimal coding knowledge but is given a tasked to run a task in UIPath and I am struggling . :expressionless: Any help is appreciated.

1 Like

Hi @Planteigne

Welcome to the community :slight_smile:

So the query window has the output in the properties and it stores the result in a DataTable, you can create it directly from the properties window by click “Ctrl+K”

Now once created add “output Data-Table” activity — It converts the result of the Data-Table to string!!!

Simply do a write line or message pop-up to get the result either in output panel or window message :slight_smile:

Hope this helps :slight_smile:

Hi Palaniyappan,

I am trying to execute a sql procedure but it is not working. I did the following changes

  1. Command Type -> StoredProcedure
  2. SQl -> Gave my procedure name
  3. Connection has been done and tested. select queries are working.
    but procedure are not working.

Can you please share a sample or screenshot of how to do it?