Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

sql query output to teams message

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. 
  • Suggested answer
    trice602 Profile Picture
    trice602 10,947 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

     


     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,532

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,050

Leaderboard