news and know-how about microsoft, technology, cloud and more.

Azure Logic Apps Toolbox 1-Use the OData Filter for Azure SQL Databases

A very quick tip today: When using an Azure Logic App in combination with an Azure SQL Database, filtering rows can be done like here.

As example: A T-SQL query as this one…

SELECT * FROM [dbo].[Customers] WHERE [StorageDataSentDate] IS NULL ORDER BY [Id]

…will be formulated as filter expression with an OData query as here.


The definition for the Get_rows_(V2) action looks similar as here:

… "Get_rows_(V2)": {
"inputs": {
"host": {"connection": {"name": "@parameters('$connections')['sql']['connectionId']"} },
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('[someserver]'))},
  "queries": {"$filter": "(StorageDataSentDate eq null)", $orderby": "Id"}
"runAfter": {"Initialize_variable": ["Succeeded"]},
"runtimeConfiguration": {
  "paginationPolicy": {"minimumItemCount": 5}
"type": "ApiConnection"
}, …

Depending on the data size, remember to configure pagination.

The output can be processed in an ForEach action as needed.

…"For_each": {
"actions": {
"Append_to_string_variable": {
"inputs": {
   "name": "Helper",
   "value": "@{items('For_each')?['StorageDataSentDate']}, @{items('For_each')?['Domain']}"
"runAfter": {},
"type": "AppendToStringVariable"
"foreach": "@body('Get_rows_(V2)')?['value']",
"runAfter": { "Get_rows_(V2)": ["Succeeded"] },
"type": "Foreach"

Happy developing Azure Logic Apps!

Comments (1) -

  • tkm

    3/25/2020 8:03:28 AM |


    Thanks for the great article.

    I have question: How do I get ODATA from stored procedure results, just the way G?