I want to query for a table in a SQL Database for a Date field greater than a certain date.
In "Filter Query" field, I put in "ExpDate ge '2020-07-18'
When I ran this Flow, I got an error saying "We cannot apply operator < to types Text and DateTime".
ExpDate is a date field in the SQL table.
So, what should the syntax be?
I set this Flow up a few months ago and it was working back then. Now, I revisited it and it is not working.
Dan Chan
Hi @js-dattics ,
This WORKED! THANKS!
I think the syntax I used ( In "Filter Query" field, I put in "ExpDate ge '2020-07-18') did work as a few months ago. Something must have changed. Regardless, what matters now is how to fix it and your suggestion DID WORK!!
Thanks!
Dan Chan
Hi.
You can't delegate filtering by dates on SQL within Power Platform.
Please check all the delegations: https://docs.microsoft.com/en-us/connectors/sql/#power-apps-delegable-functions-and-operations-for-sql-server
As stated on Microsoft site:
Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column.