简体   繁体   English

如何在复制成功或失败时从 Azure SQL 中的 Azure 数据工厂创建新表

[英]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.然后,您可以在管道中动态地将值分配给参数。

Example:例子:

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使用变量将动态值设置为存储过程参数

在此处输入图像描述

After successfully executing执行成功后

在此处输入图像描述

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Migrating Data from a SQL Server Encrypted Table to SQL Azure using Azure Data Factory Copy data - Migrating Data from a SQL Server Encrypted Table to SQL Azure using Azure Data Factory Copy data Azure 数据工厂复制活动失败将字符串(从 csv)映射到 Azure SQL 表接收器 uniqueidentifier 字段 - Azure Data factory copy activity failed mapping strings (from csv) to Azure SQL table sink uniqueidentifier field Azure数据工厂:将数据从表存储移动到SQL Azure - Azure Data Factory: Moving data from Table Storage to SQL Azure Azure数据工厂从上一个活动中选择属性“状态”:“成功” - Azure Data Factory select property “status”: “Succeeded” from previous activity Azure 数据工厂将数据从 XML 复制到 SQL 突触池 - Azure Data Factory copy data from XML to SQL Synapse pool Can we create table in SQL by passing column information from Azure blob using Azure data flow or Azure data factory? - Can we create table in SQL by passing column information from Azure blob using Azure data flow or Azure data factory? 有没有办法在使用 azure 数据工厂执行复制活动时保留 SQL 表的索引和键 - Is there a way to preserve indexes and keys of SQL table when performing a copy activity using azure data factory 使用Azure Data Factory将Azure cosmos db中的json数据复制到Azure sql - Copy json data from Azure cosmos db to Azure sql using Azure Data Factory Azure 数据工厂 - 从 SQL 到 CRM 的管道复制 - 错误 - Azure Data Factory - Pipeline Copy from SQL to CRM - Error 如何通过使用Azure Data Factory中的复制活动将常量值更新到sql表字段中 - How to update a constant value into sql table field by using copy activity in azure data factory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM