How to pass Source as a String to Sink in Copy Activity

Balachandran Kannan 181 Reputation points
2023-11-01T12:18:20.7466667+00:00

I have a Copy activity, whose Source dataset is a REST resource that returns a nested JSON. The Sink has a stored procedure with table type defined. This stored procedure is supposed to accept the JSON response and insert it to a Test-Table. Test-Table has just one column nvarchar(max) to hold the entire JSON response.

But I get error Failure happened on 'Sink' side. ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Column, parameter, or variable #1: Cannot find data type apitbl.'

Table type

CREATE TYPE [dbo].[apitbl] AS TABLE(
	[response] [nvarchar](max) NULL
)

Stored Procedure

ALTER PROCEDURE [dbo].[usp_API] (
    @apidata dbo.apitbl READONLY
)
AS
BEGIN
    INSERT into dbo.API_TEST
    select * from  @apidata;
END

Source

Screenshot 2023-11-01 at 12.02.31

Sink

Screenshot 2023-11-01 at 12.07.30

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 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.