|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Monday, July 28, 2008 12:22 PM
Points: 87,
Visits: 147
|
|
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
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 9:39 PM
Points: 2,278,
Visits: 2,998
|
|
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.
My blog: http://jahaines.blogspot.com
|
|
|
|