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 / Question SQL Query / V...
Power Automate
Suggested Answer

Question SQL Query / Variable

(0) ShareShare
ReportReport
Posted on by 21
 

Good morning,

I am currently using Power Automate Desktop for a process where I need to execute a SQL query.

My question is whether it is possible to pass a variable within the SQL statement itself, for example in a WHERE clause like:

WHERE date = %date%

The idea is to be able to pass a dynamic date value to the query at runtime.

Thank you very much in advance for your help.

I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,222 Super User 2025 Season 2 on at
    Yes you can.

    Example of where I query Excel to retrieve rows that has date 02/08/2017


    The SQL statement:
    SELECT *
    FROM [data$]
    WHERE [Date] =  '%Date%'



    If the %Date% PAD variable is of type Datetime then use #%Date%# instead of '%Date%'
  • sceleiro Profile Picture
    21 on at
    Thank you very much. I was making a mistake with the actions, which led me to think it wasn’t possible. With your explanation, I tried again and modified a few things, and now it works. Thanks!

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

#2
Tomac Profile Picture

Tomac 267 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard