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

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.



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!

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

Helpful resources

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (46,183)