Sql Server SSIS package Flat File Destination file name pattern (date, time or similar)? -
i'm scheduling ssis package exporting data flat file.
but want generate file names date information, such foo_20140606.csv
is possible?
thanks
with of expressions can make connection dynamic.
select flat file connection connection managers pane. in properties pane, click on expression(...). choose connectionstring property drop down list , in expression(...) put expression , evaluate it.
expression build -
for day : (dt_str,4,1252)day( dateadd( "dd", -1, getdate() )) month: (dt_str,4,1252)month( dateadd( "dd", -1, getdate() )) year: (dt_str,4,1252)year( dateadd( "dd", -1, getdate() ))
example expression(you need tweak per requirement) -
"e:\\backup\\employeecount_"+(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) +".txt"
which giving e:\backup\employeecount_20140627.txt
value.
please note - need working flat file connection first create flat file connection connectionstring property going replaced automatically expression.
you can follow these step step articles well.
Comments
Post a Comment