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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / sql query output to te...
Power Automate
Unanswered

sql query output to teams message

(1) ShareShare
ReportReport
Posted on by 2
I have been struggling with getting something to work in Power Automate. I have a flow that pulls rows from a table and in the row one of the columns contains a sql query, usually just a select with a where clause. I throw the sql query into a variable and execute it with the execute SQL step. The problem comes in , in that I need to iterate over the rows that are returned and somehow iterate over each column which is not fixed so i cannot use the column name. I need to add the data either to an array or a table of some sort and then after iteration include the output into the body of a chat message as either text table or perhaps an attachment. Every method I have tried ether from search or from chatgtp is not working, help please. 
Categories:
I have the same question (0)
  • Suggested answer
    trice602 Profile Picture
    15,329 Super User 2025 Season 2 on at
    sql query output to teams message
    Hi,
     
    From a very high level, what I may recommend is to moving this upstream, meaning, I would use dataflows and run your SQL query there in Dataflows/Power Query.
     
    Very, very, VERY easily, you can add a column, do your conditional output on the added column(s), then use the trigger 'When a dataflow refresh completes', you have a table that you can email, save to SharePoint, OneDrive, etc, etc.
     
     
    I often have two flows.  One that is running on a schedule that runs those queries or concats datasources, doing all the Power Query things, then a second flow with the above trigger to work with the output of the newly created table.
     
    ------------------------------------------------


    If this was helpful, please like and/or mark as a verified answer to help others find this too!


    Always glad to help! 💯💯💯💯💯

    Tom 

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

     


     
  • trice602 Profile Picture
    15,329 Super User 2025 Season 2 on at
    sql query output to teams message
    Hey there!
     
    I am following up on this post sql query output to teams message in this category building flows from 11/13/2024.  I know the post is a little older, but it is a common question here so wanted to take a moment and follow-up. I see there have been 1 replies and 1 likes and asking if your question has been answered.  If so, please help the community out by completing one or more of the following actions!  Thanks in advance!
     
    Easy as 1-2-3 ‼️💯⭐😎🆒🙏
     
    1) Mark a reply as a verified answer - this is essential, and it helps others with the same general question find this thread. ✅
    2) You can also mark one of more replies as a verified answer.  Please take a moment and give the author credit for volunteering their time. ✌️
    3) Like one or more replies.  Kudos always greatly appreciated! 👍
     
    Pro tip:  if you found your own solution or workaround, feel free to add a reply to your own post and mark it as the solution too!  The goal is to get this thread marked with a verified answer by anyone that finds one or more replies helpful!
     
    Again, thanks in advance for reading and responding, always glad to help!  Tom 💯💯💯💯💯
  • trice602 Profile Picture
    15,329 Super User 2025 Season 2 on at
    sql query output to teams message
    If I can help with anything else please let me know or tag me in a future post, I enjoy reading and answering questions.  Always glad to help!  Tom 💯💯💯💯💯

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
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard