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 / Unable to get result o...
Power Automate
Answered

Unable to get result of Execute a SQL query (v2)

(0) ShareShare
ReportReport
Posted on by 35

I have a simple Flow in which I try to get data from the sql database. Execute Query works fine, here's the example:

 

flow_result.PNG

 

but I cant get any output from that action:

flow.PNG

 

Is there anybody who could show me a working example with the V2 version of that action?

 

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    Based on the screenshots it looks like the table of results you want are in a parameter called Results Sets.  Since that is a singular object that contains an array you won't see it directly in an Apply to each.  Try using a Parse JSON action to unpack the results you get back from SQL.  Then you can process them in a loop if needed.

  • openclue Profile Picture
    35 on at

    UPDATE:

    @Pstork1 

    It seems that the problem was the query, although it was executed correctly.
    I changed to a simple query, but I have a problem with the formalParameters:

    flow.PNG

     

     

    How should I define it.

     

     

     

    @Pstork1  The problem is that I can't access the output of the "Execute a SQL query (V2)" in any way.
    I tried to use "Parse JSON" or assign an output to a variable of type object. There is nothing out of this action in Dynamic Content.

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    To use formal parameters in SQL you need to define the input parameters as part of the SQL Select.  Something like the following:

    DECLARE @par1 VARCHAR(10); Select * from table where field = @par1

    Not sure what SQL data type you are trying to pass as a parameter.  It looks like a whole record, which I'm not sure is possible.  But the lack of a Declaration of the parameter is what is causing your current issue. 

  • Verified answer
    v-alzhan-msft Profile Picture
    on at

    Hi @openclue ,

     

    Please add a Compose under the Execute a SQL query (v2) action and insert the Body to the Compose.

    Then you could add an expression to the Apply to each as screenshot below:

    1.png 2.png

     

    The expression in the Apply to each as below:

    outputs('Compose')?['ResultSets']?['Table']

    The expression in the Compose 3 as below:

    outputs('Compose_2')?['tab']

     

    The flow would run successfully as below:

    3.png

     

    Best regards,

    Alice       

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • openclue Profile Picture
    35 on at

    @v-alzhan-msft  Thx, it works exacly as I wanted.

     

    Best Regards,

    Daniel

  • Community Power Platform Member Profile Picture
    on at

    If the query don't return any results the designer can't render the dynamics contents!

     

    You must digit a query with open parameters for a sure result first.... and second, after you have designed the flow, you can set up the query with correct parameters.

     

    No Compose needed!

     

    Let me know...

     

    BR

    Daniele

  • DaveConnors Profile Picture
    34 on at

    Hi, what does "insert the Body to the Compose" mean and how do I achieve it? I have exactly this issue but I don't know what to put in the first compose.

  • Matteo96ITA Profile Picture
    3 on at

    Hi @DaveConnors ,

     

    I'm having the same problem, did you find any solution?

     

    Thanks!

  • BonusCup Profile Picture
    50 on at

    Hi, this is an older post but hope someone can help.

    @DaveConnors or @Matteo96ITA were you able to get the "insert the Body to the Compose" resolved?  I'm having this same issue.  TIA

  • Pstork1 Profile Picture
    68,717 Most Valuable Professional on at

    Please post this as a new question.  You'll get more responses and others will be able to find the answer more easily later.

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard