hi I have taking flatfile source name dynamically I.e. filename like "source 2011-08-11" I'm creating expression builder for taking most recent file as per filename. I did like Created one variable which is having folder path : C\backup\
now inside expression builder how can i add date ??? i tried like
@[User::DirPath]+"source"+ (DT_STR,4,1252)YEAR( DATEADD( "dd", -1, getdate() )) +"-"+(DT_STR,4,1252)MONTH( DATEADD( "dd",-1, getdate() ))+"-"+(DT_STR,4,1252) DAY(DATEADD( "dd", -1, getdate() )) +".CSV"
which is wrong please give me the expression which gives me output : "source 2011-08-11"
To convert Datetime to Date, we have to use "DT_DBDATE" data type.
For example, the expression Column1 + " ABC" can be used to update a value or to create a new value with the concatenated string. Variables use an expression to set their value. For example, GETDATE() sets the value of the variable to the current date.
Correct expression is
"source " + (DT_STR,4,1252)DATEPART( "yyyy" , getdate() ) + "-" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , getdate() ), 2) + "-" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , getdate() ), 2) +".CSV"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With