Showing results for 
Search instead for 
Did you mean: 
New Member

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
Community Support

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.
Advocate II
Advocate II

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!

Advocate I
Advocate I

Re: Syntax for GetRows

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

Helpful resources


August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!


Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021


Power Automate Community User Group Member Badge

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

Users online (3,692)