Dear Members,
I am trying to create an Azure Logic App which will receive a JSON document from an HTTP Request. This Logic app will then load this JSON data into Azure SQL DB table. But, instead of simply loading the data into SQL DD, I want to implement UPSERT logic through Logic app which will check if the record already exists in the DB table and if it exists, then it will update the record otherwise, will simply insert new record into the table. This can easily be done by creating a Stored Procedure in the Azure SQL DB and then calling this Stored Procedure from Logic app through SQL Server Action/Connector (Execute Stored procedure (V2)). Unfortunately, we cannot create this Stored procedure as we are not the owner of this DB and hence, we need to implement this UPSERT logic completely in the Logic App with the help of Actions/ Connectors.
For this, I am implementing following steps:
HTTP Request to get the JSON file
For-each to iterate over JSON Objects
2.1. Get row (V2) action of SQL Server to check if the current JSON record already exists in the table.
2.2. Condition to check if result of "Get row (V2)"(step 2.1) is empty and based on this condition, the Logic App will run either Update row (V2) or Insert row (V2).
When the Logic app is triggered, it fails at step 2.1 with error as:
"status": 404,
"message": "Item with id '001' does not exist.\r\nclientRequestId: 9f0d4cae-0bd8-461e-979b-0aa1bb689298",
"error": { "message": "Item with id '001' does not exist." }
Is there any way we can implement this upsert logic into Logic App without using Stored Procedure?
Thanks in Advance!
