Logic App Runs Execute stored procedure (V2) twice if the procedure has a RAISERROR block

Santhoshkumar Boregowda 0 Reputation points
2025-04-02T14:01:21.56+00:00

We observed an unusual behavior in our Logic App where the Execute Procedure action was being triggered twice. After investigating further, we found that if a RAISERROR statement is executed within the stored procedure, the Execute Procedure action gets invoked again from Logic App.

Has anyone else encountered this issue? Is this expected behavior, or is there a way to prevent the duplicate execution?

Steps to Reproduce execution of "Execute Stored Procedure (V2))" twice.

Very simple logic appUser's image

No retry policy set

User's image

Simple table and stored procedure

CREATE TABLE dbo.test(id INT IDENTITY(1,1), col_value VARCHAR(1000))

GO

CREATE OR ALTER PROC dbo.test_insert @val varchar(1000)

AS

INSERT INTO dbo.test(col_value)VALUES(@val)

RAISERROR(@val, 16, 1) /*Comment and Uncomment as needed*/

/* Please note that, the actual scenario is different where we need to throw the error when certain conditions are not met - this code block is just a sample*/

GO

--Run from SSMS

--EXEC dbo.test_insert @val = 'abc'

--Verify data

SELECT * FROM dbo.test ORDER BY 1 DESC

The action was called twice when the table results are seen.

User's image

Also, the SQL Profiler confirms there were 2 calls from Azure (Mashup Engine)

User's image

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,449 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.