gpt4 book ai didi

sql - 在 SQL 查询中连接 Azure 数据工厂管道参数

转载 作者:行者123 更新时间:2023-12-03 02:12:35 25 4
gpt4 key购买 nike

Azure 数据工厂管道正在获取存储在数据库表中的 SQL 查询。例如。查询:

Select * from employees where first_name = 'Sam' and last_name = 'mathew'

我需要以这样的方式更新查询:fnamelname 将成为 azure 数据工厂管道中的参数pipeline().parameters.fnamepipeline().parameters.lname

如何修改查询以在 SQL 查询中使用这些管道参数?

注意:SQL 查询存储在数据库表中。管道将在复制数据管道步骤

中获取 SQL 查询

最佳答案

按照@Nandan的建议,您必须通过在数据库中创建存储过程并在副本中传递管道参数来完成此操作事件。

请按照以下演示进行操作:

  • 此处,我将查询中选定的数据复制到 blob 中的 csv 文件。您可以复制到任何您想要的地方。

  • 这是我的示例 SQL 表enter image description here

  • 我正在数据库中创建存储过程,如下所示,使用 fnamelname 作为参数,并在 sql 中使用 concat() .

create or alter procedure dbo.proc1 @fname nvarchar(32),@lname nvarchar(32)
as
begin
select concat(firstname,' ',lastname) as employee_name from [dbo].[employees] where employees.firstname=@fname and
employees.lastname=@lname;
end

enter image description here

  • fnamelname 创建管道和参数,默认值如下。

enter image description here

  • 现在创建一个复制事件,并将SQL 表作为源,然后按照以下步骤操作。

enter image description here

  • 提供您的接收器数据集,我的案例接收器是 blob 中的 csv 文件。
  • 现在,执行管道并给出 fnamelname 参数值。

enter image description here

  • 点击“确定”,您可以将所选数据从数据库中的查询复制到您的接收器。

我的输出:

enter image description here

关于sql - 在 SQL 查询中连接 Azure 数据工厂管道参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72891620/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com