Azure Data Factory动态内容参数

问题描述 投票:0回答:1

我正在尝试使用Azure Data Factory从源表加载上次运行时的数据到lastmodifieddate。

这工作正常:

@concat(' SELECT  * FROM dbo. ',
        item().TABLE_list ,
       ' WHERE   modifieddate > DATEADD(day, -1, GETDATE())')"

我用的时候:

@concat(' SELECT  * FROM dbo.  ',
         item().TABLE_list ,
        '  WHERE   modifieddate > @{formatDateTime(
                  addhours(pipeline().TriggerTime-24)),
                  ''yyyy','-','MM','-','ddTHH',':','mm',':','ssZ''}')

得到错误为“”errorCode“:”2200“,

"message": "Failure happened on 'Source' side. 'Type=System.Data.SqlClient.SqlException,Message=Must declare the scalar variable \"@\".,Source=.Net SqlClient Data Provider,SqlErrorNumber=137,Class=15,ErrorCode=-2146232060,State=2,Errors=[{Class=15,Number=137,State=2,Message=Must declare the scalar variable \"@\".,},],'",
    "failureType": "UserError",
    "target": "Copy Data1"
}
  • 我在做什么错?
  • 我需要在where where condition下动态传递管道的最后运行时间日期。
azure azure-data-factory
1个回答
1
投票

select * from dbo。@ {item()。TABLE_LIST} WHERE modifieddate> @ {formatDateTime(addhours(pipeline()。TriggerTime,-24),'yyyy-MM-ddTHH:mm:ssZ')}

您可以使用字符串插值表达式。 Concat让事情变得复杂。

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#expressions

© www.soinside.com 2019 - 2024. All rights reserved.