I am doing copy activity in Azure data factory. I am copying csv file to azure sql db. I already setup all the things from linker service to data set. What I want is if copy activity succeeded or fail then I want to insert TableName, No. of rows copied and status (succeeded, fail) into Another table in Azure SQL. How can it be done.
You can use parameterized StoredProcedure Activity . You can then assign the values to parameter dynamically in pipeline.
Table to store copy details.
Create table [dbo].[CopyDetails](
TableName nvarchar(max),
NoOfRows int,
CopyStatus nvarchar(max)
)
Stored Procedure in same database as being copied
CREATE PROCEDURE recordDetails @TableName nvarchar(max), @NoOfRows int, @CopyStatus nvarchar(max)
AS
Insert into [dbo].[CopyDetails]
VALUES
(@TableName, @NoOfRows, @CopyStatus)
GO
Create Variables accordingly in Pipeline
Sample working pipeline
Set variableRowsCopied
@string(activity('Copy data1').output.rowsCopied)
Set variableStatus
@activity('Copy data1').output.executionDetails[0].status
Set StoredProcedure Activity
Use variable to set dynamic values to Stored procedure parameters
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.