web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Assign Execute a SQL q...
Power Automate
Unanswered

Assign Execute a SQL query (v2) to a variable

(0) ShareShare
ReportReport
Posted on by 84

Is there any way that I can assign my SQL SELECT statement result to a variable so that I can use it in further steps?

In the same way we declare variables in SQL and assign values to it.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at

    @AmirZolf 

     

    You dont need too. Any action that you perform, the output is available to the rest of the flow. You just need to know what dynamic property to access.

     

    The output of a SQL Query would be an Outputs or Body which is going to be an Array of your Results

     

    If you show your flow, and if you add a Compose right after your Query Action. Then just click in the box, let the Dynamic Properties windows popup. Scroll to the section that is for the Output of your SQL Action and you will see. Please feel free to share the image if you are having issues finding it.

     

    Please mark this as Resolved and maybe also a Thumbs Ups.

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Amirhz Profile Picture
    84 on at

    There are other Dynamic contents there, but not this one!

     

    AmirZolf_0-1696618426124.png

     

  • Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at

    Hi @AmirZolf 

     

    body has what you need (its the results) If you click on body and add it to the compose. Then hover your mouse over the added property (dont click it) you wil see something like

    body('Execute_a_SQL_query_(V2)') 

     

    then you access your data (and I have no idea what yours looks like) via that.

    Essentially its a JSON Array. Which means you normally access it with an Apply to each, where you would put the body, in the Input.

     

    That would loop through your results.

    As it loops you would have access to the columns and their values based on the iteration of the loop as it goes row to row.

     

    I hope that makes sense.


    If I have answered your question, it would be helpful if you Mark my response as an Answer/Resolved and maybe even a thumbs up.


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Amirhz Profile Picture
    84 on at

    Well, that is my problem. The body for that query does not populate.

    It is for the other one.

    AmirZolf_0-1696619389283.png

     

     

     

     

  • Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at

    @AmirZolf  Can you scroll up and down in the dynamic window and see if its there. I only said click that one as I didnt see you had 2.

     

  • Amirhz Profile Picture
    84 on at

    What can be the reason that step does not show up on the list at all!?

     

    AmirZolf_0-1696620312407.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard