Showing results for 
Search instead for 
Did you mean: 
Level: Power Up

Syntax for GetRows

Hi everyone,


I'm new to the community and have just started using Flows. Really cool possibilites but I need a little help. We use MS SQL on prem and I am trying to filter a GetRows action using a standard Select statement: 


[Patient ID]
FROM [AthenaDataWarehouseFeed].[dbo].[patientinsurance]
WHERE ([Expiration Date] IS NULL OR [Expiration Date] = '')


When I try this, I get an error as follows:


Manage your flows | Microsoft Flow

{ "status": 400, "message": "Term 'SELECT [Patient ID]FROM [AthenaDataWarehouseFeed].[dbo].[patientinsurance]WHERE ([Expiration Date] IS NULL OR [Expiration Date] = '')' is not valid in a $select or $expand expression.\r\n inner exception: Term 'SELECT [Patient ID]FROM [AthenaDataWarehouseFeed].[dbo].[patientinsurance]WHERE ([Expiration Date] IS NULL OR [Expiration Date] = '')' is not valid in a $select or $expand expression.", "source": "" }
I have been able to use SQL actions successfully in Flows to move information between Sharepoint and SQL Server without any problems up until now when I am trying to limit the GetRows return result. I can't find any real documentation for Flow regarding the use of different Action types or syntax. Any help would be greatly appreciated.
Community Support Team
Community Support Team

Re: Syntax for GetRows

Hi @sbarre,


Could you please share about where you put the select sentence ?


If you are using the SQL Server Get Rows:


The Select Query and the Filter query part, works only with the OData query parameter, it can't be used to execute the SQL language.

Basic Tutorial

For the Null value with the Expiration Date, I am afraid currently it is not working.

As the NULL value can't be recognized under Microsoft Flow, also the '' not work as well.

In addition, Column name with sapce should be write in the format below:


Use the _x0020_ to replace the Space.

For the Select query, just use the column name, then seperate them with comma.


If you have any further questions, please post back.



Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level: Powered On

Re: Syntax for GetRows



I am trying to achieve something similar. I am collecting use email from Microsoft form and then want to extract manager's email id for that user from Azure DB to send approval request. I've a table UserDetails which contains UserName, Email and ManagerName. Once I extract ManagerName for the user, I can get his email id from the same table(self join). I am not sure how to implement self join in flow. Looking for other suggestions as well.


Thank you!

Level: Powered On

Re: Syntax for GetRows

How do you add a where clause to this? I am using SQL on Prem

Helpful resources


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,609)