How to pass Source as a String to Sink in Copy Activity
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
Sink