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 Automate
Unanswered

sql query results

(0) ShareShare
ReportReport
Posted on by 72

I have a PAD where I am running a SQL statement to calculate a rather complex time differential equation. where the query executes their will only ever be 1 value return in the output. It appears that the output of the SQL statement comes back as a data table with 1 column and 1 row. I need to be able to use this value as part of another calculation further down in my PAD process but can't seem to find the best way to get the value out as a variable to use. Any help or guidance would be greatly appreciated.

I have the same question (0)
  • Verified answer
    LokeshBysani Profile Picture
    229 Super User 2024 Season 1 on at

    @lkhall_37203  Lets say you have a datatable variable called %SQLResultsTable% with 1 row and 1 column as below and if you want to extract the result 45 and use it in downstream. follow this approach.

    1. set variable action and provide a variable name 

    •     %SQLResultsTable[0][0]%  
    • LokeshBysani_1-1692034430367.png

       

    LokeshBysani_0-1692034354283.png

     

  • lkhall_37203 Profile Picture
    72 on at

    thanks, works perfect I was using %SQLResultsTable[0]% which makes sense now why it wasn't working. 

  • LokeshBysani Profile Picture
    229 Super User 2024 Season 1 on at

    @lkhall_37203 When working with data tables in Power Automate, you can use the following approaches to retrieve specific column values:

    1. To fetch values using row and column indices:

      • %SQLResultsTable[rowindex][columnindex]%
      • For example: %SQLResultsTable[0][0]% (fetches the value from the first row and first column), or %SQLResultsTable[0][2]% (fetches the value from the first row and third column).
    2. To fetch values using column names:

      • %SQLResultsTable[rowindex]['columnName']%
      • For instance: %SQLResultsTable[0]['Result']% (fetches the value from the 'Result' column for the first row).

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard