When an item is created (V2) - Select query issues

R13 0 Reputation points
2023-05-17T11:53:30.0733333+00:00

I have a Logic App set up to fire off an email every time a new item is created in a certain database table.

This works perfectly.

We have 3 "Funds" currently, that create rows.
I would like to replicate this Logic App out 3 times to alert each "Fund" of their successful entry once our application has run.

Seemed like it should have been fairly straight forward but I am going in circles trying to get the "Select Query" syntax correct.

The error is as follows:

Operation Name: When_an_item_is_created_(V2)

Error Details: Term 'SELECT * FROM [dbo].[REDACTED] WHERE FundName = 'REDACTED'' is not valid in a $select or $expand expression. inner exception: Term 'SELECT * FROM [dbo].[REDACTED] WHERE FundName = 'REDACTED'' is not valid in a $select or $expand expression.

Server Name, Database Name, Table Name is all the same as the original App and when the Select Query is left blank it works in the sense it fires an email every time a new row is entered.

Select Queries I have tried are:

WHERE FundName = 'REDACTED'

SELECT * WHERE FundName = 'REDACTED'

SELECT * FROM [dbo].[REDACTED] WHERE FundName = 'REDACTED'

Unfortunately none of these have worked and I'm confused as to what I am missing.

Thanks,
Rhys

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,842 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 18,191 Reputation points Microsoft Employee
    2023-05-18T10:56:20.2633333+00:00

    @R13 Thank you for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    Based on the shared information, we have understood that in your logic app workflow you are using When_an_item_is_created_(V2) as trigger and you what to filter the records which has FundName = 'REDACTED' in the same step only using where condition.

    • You cannot pass any condition to Select Query parameters, select query parameter is to list the output columns that you want to see in the query output.

    User's image

    • You need to use Filter Query parameter to filter the data by using ODATA filter query as shown below.
      User's image

    Before using the filter query just make sure your logic app is getting triggered when a new item got inserted into the sql server.
    For more information, you can go through the Azure SQL server connector documentation.
    Feel free to reach back to me if you have any further questions on this.