Skip to main content

Notifications

Community site session details

Community site session details

Session Id : MkuGUU66harBWd/NUFxB0o
Power Automate - Using Flows
Answered

Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

Like (0) ShareShare
ReportReport
Posted on 23 Aug 2022 07:15:41 by

Hi everyone,

 

Im executing a stored procedure in an On Prem SQL Server, I havent had much luck obtaining the data in the result sets that is presented back. I can obtain a single value ok , hand have so previously in the past ie return codes, but cannot seem to get a result set of data reliabily. ie multiple rows with multiple columns

Examples are slim pickings ( parse json etc Ivew seen and used but run into errors of one kind or another ).

Anybody have a full example that can be followed? i've scanned the forum

 

The end game is to obtain the SP rowset and place into an email  and send.

Any help appreciated

 

Mike

  • Verified answer
    Community Power Platform Member Profile Picture
    on 08 Sep 2022 at 03:10:21
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    hope this helps someone else...

  • Community Power Platform Member Profile Picture
    on 08 Sep 2022 at 03:09:19
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    Found a solution to get at the elements, ( there may be other ways but this works ok for me ).

     

    Execute the SQL Stored procedure and in the 'Apply to each' ensure the Output from the previous step is set to address the returned table in the output of the stored procedure, not the Resultset!.  This exposes each of the elements such that they can be addressed individually. The line HTML is then wrapped around each of the elements and an HTML Header information is placed in the email. 

     

     

    majero_0-1662606000923.png

     

    majero_2-1662606519047.png

     

    I did try the Create HTML table action but couldnt get it to work correctly and ran out of development time.

     

     

     

  • Community Power Platform Member Profile Picture
    on 25 Aug 2022 at 06:24:26
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    for others that might follow..

    I have got a bit further , below provides basic output from the stored procedure. Still cannot get at the elements, <br> provides a line feed.

    majero_0-1661408620897.png

     

    majero_1-1661408655223.png

     

     

     

  • Community Power Platform Member Profile Picture
    on 25 Aug 2022 at 00:38:46
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    I realise the Output of the Resultset has to be an array, but cannot get at the contents of the Resultset array correctly.. ( multiple columns with probably 5-10 rows )

  • Community Power Platform Member Profile Picture
    on 25 Aug 2022 at 00:36:55
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    Apologies a picture is worth a thousand words

    majero_0-1661387751509.png

     

     

    dies with

     

    majero_1-1661387807387.png

     

     

  • Community Power Platform Member Profile Picture
    on 23 Aug 2022 at 20:12:58
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    Thanks Kaif,

    Im using the SQL exec stored procedure to run the proc. Running the procedure isnt the issue.

    Its the working of the resultset ( multiple rows , multiple columns ), so I can assemble it into an email and send

    I have a for each look on the ResultSet table,and that loops for the number of rows returned, however, I cannot address the Items within with Items()?[ 'Column Name']. 

    thanks

  • Kaif_Siddique Profile Picture
    2,104 Super User 2024 Season 1 on 23 Aug 2022 at 18:12:31
    Re: Power Automate OnPrem SQL Stored Procedure execute obtaining Result sets ( multiple rows, Multiple Columns )

    Hi Majero,

     

    Do you want to retrieve the stored procedure query results(recordset)? If yes, you can call stored procedure using Exce function with parameters to get the query results output. Please refer below

    Kaif_Siddique_2-1661277969493.png

     

    Regards

    Kaif

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow