Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
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?

 

 

  • Pstork1 Profile Picture
    65,999 Most Valuable Professional on at
    Re: Unable to get result of Execute a SQL query (v2)

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

  • BonusCup Profile Picture
    50 on at
    Re: Unable to get result of Execute a SQL query (v2)

    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

  • Matteo96ITA Profile Picture
    3 on at
    Re: Unable to get result of Execute a SQL query (v2)

    Hi @DaveConnors ,

     

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

     

    Thanks!

  • DaveConnors Profile Picture
    34 on at
    Re: Unable to get result of Execute a SQL query (v2)

    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.

  • Community Power Platform Member Profile Picture
    on at
    Re: Unable to get result of Execute a SQL query (v2)

    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

  • openclue Profile Picture
    35 on at
    Re: Unable to get result of Execute a SQL query (v2)

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

     

    Best Regards,

    Daniel

  • Verified answer
    v-alzhan-msft Profile Picture
    on at
    Re: Unable to get result of Execute a SQL query (v2)

    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.

  • Pstork1 Profile Picture
    65,999 Most Valuable Professional on at
    Re: Unable to get result of Execute a SQL query (v2)

    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. 

  • openclue Profile Picture
    35 on at
    Re: Unable to get result of Execute a SQL query (v2)

    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
    65,999 Most Valuable Professional on at
    Re: Unable to get result of Execute a SQL query (v2)

    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.

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,660 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