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 / Get single row from SQ...
Power Automate
Unanswered

Get single row from SQL Server

(1) ShareShare
ReportReport
Posted on by 8
Does anyone have any tips on getting a single row from a table in a sql database?

There are two connectors I see. One for ‘Get Row’ which seems like it only takes an actual row number, which isn’t really helpful. The other is ‘Get Rows’ which I can easily pass what I need to it and only have it return one row, but then I have to loop through that data to get the data I need.
Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @jeremy_brown,

     

    Could you please share a screenshot of your flow's configuration?

    Could you please show a bit more about your scenario?

    Further, do you want to get a single row without using the "Apply to each" action?

     

    The output of the "Get items" action is an array, so when you reference the Dynamic contents of the "Get items" action within following steps, the flow would add a "Apply to each" action automatically, even though the output of the "Get items" action only contains one row.

     

    If you want to get the single row from the "Get items" action without using a "Apply to each" action, please take a try with the following workaround:

    • Add a proper trigger, here I use Flow Button trigger.
    • Add a "Get rows" action, specify Table name. Within Filter Query field, type the following formula:
    Email eq 'Test1@xxxxxx.onmicrosoft.com'

    Note: The Email is a column in my SQL table and each row have a unique Email value.

    • Add a "Compose" action, Inputs set to following formula:
    first(body('Get_rows')?['value'])

    Image reference:9.JPG

    The flow works successfully as below:10.JPG

     

    In addition, if you want to reference the column values within that single row (as above screenshot), you could consider take a try with the following formula:

    outputs('Compose')?['ContactName']

    On your side, you should type the following formula:

    outputs('Compose')?['ColumnNameOfYourSQLTable']

    11.JPG

    The flow works successfully as below:

     12.JPG

     

    More details about using expression in flow actions, please check the following article:

    Use expression in flow actions

     

     

     

    Best regards,

    Kris

  • jeremy_brown Profile Picture
    8 on at

    @v-xida-msft that worked perfectly.  I will probably use a combination of Compose and maybe Parse JSON to hold my entire table row.  This makes what I was doing so much simpler/cost effect. 

     

    Thanks!

     

  • MichelH Profile Picture
    401 on at

    I was surprised to find MS Flow does not allow me to specify the column name in the 'get row' for which I have a unique value.

     

    As if they were only having a spreadsheet in mind when designing this.  😕

     

    I guess this workaround (thank you Kris), is as good as it gets, but it does make the resuting flow less clear for another person who needs to maintain it later.

     

    Thanks to all for their input here.

  • TheFreeMan Profile Picture
    48 on at

    Amazingly, MS does allow you to get just a few columns from a table instead of the whole thing. It's right there in the `Get Rows` step, the last item under `advanced options` - `Select Query`.

    TheFreeMan_0-1715343689456.png

     

    Simply provide a comma delimited list of columns you're after, and those change the `SELECT *` to `SELECT <columns>` in the query executed.

  • MichelH Profile Picture
    401 on at

    I know you can select the columns returned.
    I probable was not clear.
    Get row only accepts the ID to select a record, not any other unique column.

    I used to have tables with many unique columns, multiple indexes if you will.
    I still have no idea how to do that with get row.

    Maybe it is simply beyond low code/no code

  • TheFreeMan Profile Picture
    48 on at

    Gotcha, my bad.

     

    Yeah, "no code" only gets you so far. Most of the things I've done so far are, I think, pushing the "no code" boundary. There are many times that I think, "I've spent a week beating my head on this Flow/App - this would be so simple in VBA!"

  • MichelH Profile Picture
    401 on at

    Hey no problem,
    Thank you for thinking along with me.

    Indeed I'm trying to convince people in my company to get a subscription to use azure functions.
    Running stuff in python would cover a lot of the gaps in power automate abilities.

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