February 2, 2017 at 9:24 am
Hello,
I am receiving following error while executing For Each loop container task.
Error occurred attempting to convert from data type DT_WSTR to data type DT_DATE.
@[User::ProcessThisFile] =((DT_DATE) left(Reverse(Left(REVERSE( @[User::ECGVolumeFilePath] ),FINDSTRING( REVERSE( "\\" + @[User::ECGVolumeFilePath] ),"\\",1)-1)),10) >= @[User::from_date] ) && ( (DT_DATE) left(Reverse(Left(REVERSE( @[User::ECGVolumeFilePath] ),FINDSTRING( REVERSE("\\" + @[User::ECGVolumeFilePath] ),"\\",1)-1)),10) <= @[User::to_date] )
From_date: (@[$Package::StartDate] < (DT_DATE) "1900-01-01")? (DT_DATE)(DT_DBDATE)dateadd("dd", 0, dateadd("dd", (datepart("dw", getdate()) * -1) + 2, getdate()),) : @[$Package::StartDate]
to_date: ( @[$Package::EndDate] < (DT_DATE) "1900-01-01")? (DT_DATE)(DT_DBDATE)dateadd("dd", -1, dateadd("dd", (datepart("dw", getdate()) * -1) + 2, getdate()),) : @[$Package::EndDate]
Can anyone please help?
February 2, 2017 at 9:32 am
It looks as if you're trying to extract a date from a file path - is that right? I think what's happening is that whatever it is that you extract isn't in a format that can be converted to a date. Try it without the conversion, just to see what string it is that you're attempting to convert.
John
February 2, 2017 at 9:35 am
John Mitchell-245523 - Thursday, February 2, 2017 9:32 AMIt looks as if you're trying to extract a date from a file path - is that right? I think what's happening is that whatever it is that you extract isn't in a format that can be converted to a date. Try it without the conversion, just to see what string it is that you're attempting to convert.John
Can you please provide example?
February 2, 2017 at 9:44 am
Something like this:( left(Reverse(Left(REVERSE( @[User::ECGVolumeFilePath] ),FINDSTRING( REVERSE( "\\" + @[User::ECGVolumeFilePath] ),"\\",1)-1)),10) )
I may have mangled your parentheses a little, but you get the idea. What you need to do is inspect everything that you're attempting to convert to a date to check that it can be converted to a date.
John
February 2, 2017 at 10:48 am
John Mitchell-245523 - Thursday, February 2, 2017 9:44 AMSomething like this:( left(Reverse(Left(REVERSE( @[User::ECGVolumeFilePath] ),FINDSTRING( REVERSE( "\\" + @[User::ECGVolumeFilePath] ),"\\",1)-1)),10) )
I may have mangled your parentheses a little, but you get the idea. What you need to do is inspect everything that you're attempting to convert to a date to check that it can be converted to a date.John
I have played around the found the solution.
Thanks for your help though.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply