pmichalowski
pmichalowski

Reputation: 11

Azure data factory slicestart format error

I've been trying to set in SELECT parameter - slicestart time to gather just lately changed records:

WHERE pv.CreatedAt >= \\'{0:yyyyMMdd-HH}\\'', Time.AddHours(SliceStart, 0))"

and I got error:

Database operation failed. Error message from database execution : ErrorCode=FailedDbOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Conversion failed when converting date and/or time from character string.',Source=,''Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Conversion failed when converting date and/or time from character string.',Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,Message=Conversion failed when converting date and/or time from character string.,Source=.Net SqlClient Data Provider,SqlErrorNumber=241,'.

Upvotes: 1

Views: 463

Answers (2)

Ritesh
Ritesh

Reputation: 1034

In addition to what @Luis answer.

You have to make sure that the source date format must match the format of date being passed.

For eg:- If the source is Oracle then write query as below:-

WHERE TO_DATE(pv.CreatedAt,'YYYY-MM-DD') >= \\'{0:yyyy-MM-dd}\\'',SliceStart))"

Upvotes: 0

Luis Figueroa
Luis Figueroa

Reputation: 21

I see you are using the Time.AddHours() function but passing 0 as a parameter which would add zero hours to the SliceStart value. If you did not intend to increment the SliceStart time try the following:

"sqlReaderQuery": "$$Text.Format('select ... where pv.CreatedAt >= \'{0:yyyy-MM-dd}\', SliceStart)"

Cheers, Luis

Upvotes: 0

Related Questions