Reputation: 13
I am trying to load the data from the last runtime to lastmodifieddate from the source tables using Azure Data Factory.
this is working fine :
@concat(' SELECT * FROM dbo. ',
item().TABLE_list ,
' WHERE modifieddate > DATEADD(day, -1, GETDATE())')"
when i use:
@concat(' SELECT * FROM dbo. ',
item().TABLE_list ,
' WHERE modifieddate > @{formatDateTime(
addhours(pipeline().TriggerTime-24)),
''yyyy','-','MM','-','ddTHH',':','mm',':','ssZ''}')
getting error as ""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"
}
what mistake am I doing?
I need to pass dynamically last run time date of pipeline after > in where condition.
Upvotes: 0
Views: 5282
Reputation: 2363
SELECT *
FROM dbo.@{item().TABLE_LIST}
WHERE modifieddate >
@{formatDateTime(addhours(pipeline().TriggerTime, -24), 'yyyy-MM-ddTHH:mm:ssZ')}
You could use string interpolation expression. Concat makes things complicated.
Upvotes: 2