[英]How to create new table from Azure data factory in Azure SQL when copy succeeded or fail
I am doing copy activity in Azure data factory.我正在 Azure 数据工厂中进行复制活动。 I am copying csv file to azure sql db.
我正在将 csv 文件复制到 azure sql db。 I already setup all the things from linker service to data set.
我已经设置了从 linker 服务到数据集的所有内容。 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.
我想要的是,如果复制活动成功或失败,那么我想将 TableName、复制的行数和状态(成功,失败)插入 Azure SQL 中的另一个表中。 How can it be done.
怎么做到呢。
You can use parameterized StoredProcedure Activity .您可以使用参数化的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设置变量RowsCopied
@string(activity('Copy data1').output.rowsCopied)
Set variableStatus设置变量状态
@activity('Copy data1').output.executionDetails[0].status
Set StoredProcedure Activity设置 StoredProcedure 活动
Use variable to set dynamic values to Stored procedure parameters使用变量将动态值设置为存储过程参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.