我正在尝试使用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"
}
select * from dbo。@ {item()。TABLE_LIST} WHERE modifieddate> @ {formatDateTime(addhours(pipeline()。TriggerTime,-24),'yyyy-MM-ddTHH:mm:ssZ')}
您可以使用字符串插值表达式。 Concat让事情变得复杂。