Stored procedure returns two results, but UiPath get only the first one

I execute a stored procedure that normally returns two results with Execute Query. UiPath takes only the first one and stored it in a data table. It there a way to access the second result two and store it in another data table?



Hi Eduard,

If you find a solution to this issue please contact me as I encountered the same problem as you.


Hi @Eduard-Iulian @vlad.gheorghiu

Could you provide an example please? :slight_smile:

Hi there! I actually encountered the same thing and can provide an example. Here is the input and output as displayed in MSSQL SMS (with obfuscated data). Notice that there are two result datasets - one with the affected columns and another with context in the table as well as information about the user that submitted the request. This is the normal response for this sproc:

In UiPath Studio, we are only given 1 output variable for the “Execute Query” activity. From my observations, the output DataTable only retrieves the first table, as the original poster mentions.

After researching it briefly, there doesn’t appear to be one way to dynamically combine multiple result sets from a single stored procedure into a single table; however, if you are able to modify the stored procedure, you could use output parameters and capture these in variables outside the procedure. Something like this: sql server - INSERT INTO with exec with multiple result sets - Stack Overflow

I would be interested to know how the UiPath activity was developed so that it returns any result set as long as it’s the first one :slight_smile:

1 Like

If you have the knowledge, you could have a look yourself. The Database activity pack is one of the ones we made available open source :slight_smile: