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 / SQL ODATA Filter Query...
Power Automate
Unanswered

SQL ODATA Filter Query on DateTime

(1) ShareShare
ReportReport
Posted on by 5
I'm querying a SQL Server through Power Automate, however it's on premises and therefore the 'execute query' isn't viable, and neither is 'execute stored procedure' due to contractual restraints on the use of the server.
 
I'm using 'Get Rows' with an ODATA filter query to limit the records output. I need to filter by a datetime value where both the date and time components are relevant. However, when I attempt a direct comparison between the output from my SQL Server and a datetime value in power automate, I only get an empty array.
 
EG: End_Time lt 2025-06-20T09:21:00.000Z
 
I've formatted the datetime value in countless different ways, but none work.
 
I've been able to use the date(), time(), minute(), and hour() wrappers in my filter query to work around this limitation, but it extends the duration of the flow substantially as it completes several row by row checks.
 
date(End_Time) eq date(@{outputs('timestamp')})
 and hour(End_Time) eq hour(@{outputs('timestamp')})
 and minute(End_Time) eq minute(@{outputs('timestamp')})
 
Is there a way to directly filter by DateTime values in the SQL Server connectors 'Get Rows' action?
 
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at
     
    In the first OData query you are also using the z specifier. Have you double checked that it is not an offset/timezone issue?
    https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings#zSpecifier

     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • QAC-Ryan Profile Picture
    5 on at
    @Expiscornovus, I've tried it without Z specifier but it hasn't made a difference unfortunately!
     
    Even if the time was offset by some value, I would expect the first query (using the lt comparator) to provide at least some values in the past, even if they fall within an offset time period.

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