cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sbarre
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: 

 

SELECT
[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": "127.0.0.1" }
 
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.
 
Regards,
 
Stewart
3 REPLIES 3
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:

2.PNG

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:

Expiration_x0020_Date

Use the _x0020_ to replace the Space.

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

3.PNG

If you have any further questions, please post back.

Regards,

Michael

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.
ppande
Level: Powered On

Re: Syntax for GetRows

Hello,

 

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!

sgregory
Level: Powered On

Re: Syntax for GetRows

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 91 members 4,805 guests
Please welcome our newest community members: