I am using Azure Logic App to execute a stored procedure that accepts a string input.
Here is the definition of the stored procedure:
ALTER PROCEDURE [ResMgmt].[usp_ExtractReportBlob]
(@ReportFileName VARCHAR(255),
@ReportBlobName VARCHAR(255) OUTPUT)
AS
BEGIN
DECLARE @SQL VARCHAR(MAX),
@ReportSPROCName VARCHAR(MAX);
SET @ReportSPROCName = (SELECT ReportSPROCName
FROM ResMgmt.ReportMetadata
WHERE ReportFileName = @ReportFileName);
SET @SQL = 'EXEC ' + @ReportSPROCName + ';';
SELECT (@SQL);
SET @ReportBlobName = '/<azure-storage>/' + @ReportFileName;
RETURN @ReportBlobName;
END;
The stored procedure ultimately outputs a string that will be used by Logic App, but first thing's first... I cannot get my Attachments Name
iterator to be used as an input for the stored procedure. The stored procedure accepts parameter ReportFileName
, which will be coming from the iterator of the For Each step:
You can see that, in the code view, I am referencing the item()
dynamically in the body
key of the json
structure:
But I end up with this error in debug:
When I run from debug, I get the error above. It seems like the json
format is correct, so I don't understand why the error is occurring. For example, I can confirm that the correct string value DTG Active Client List Daily.csv
is getting passed to the stored procedure key ReportFileName
.
How do I pass this variable to my stored procedure?
I figured it out, and it's very simple. I decided to switch to Execute a SQL Query
step for ease, but it worked under the old method as well.
I am passing a string variable to my stored procedure. The json
"looks" correct because it's contained within double-ticks (eg " "
). But the stored procedure is expecting a string contained within single-ticks (eg ' '
). I had to manually wrap my variable with the single-ticks.
Like so:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.