March 4, 2008 at 7:15 am
I'm trying to build an expression for the remote path in an FTP Task. When I enter
"/out/export/" + (DT_WSTR, 4) YEAR( GETDATE() ) + RIGHT( "0" + (DT_WSTR, 2) MONTH( GETDATE() ) , 2 ) everything work fine.
However, when I add + RIGHT("0" + (DT_WSTR,2) DatePart("dd", -1, GETDATE()),2) I get a truncation error. What I'm trying to do is make sure that I have a two digit day.
Any help would be appreciated.
Tim
March 4, 2008 at 10:09 am
The easiest method would be to make a variable that evaulates as an expression. Your variable expression should look like this
"/out/export/" + RIGHT("0" + (DT_WSTR,2) datepart("d",Dateadd("dd", -1, GETDATE())),2)
Then in the connection string expression just call the variable.
RIGHT("0" + (DT_WSTR,2) DatePart("dd", -1, GETDATE()),2)
This will always produce errors because you are providing to many parameters for datepart. The datepart parameters are (datepart,date). I think you are tying to use dateadd which requires three parameters (interval,numer, date).
I resolved what I believe you were trying to accomplish in the code block above.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply