I'm scheduling a SSIS package for exporting data to flat file.
But i want to generate file names with some date information, such as foo_20140606.csv
Is it possible?
Thanks
I'm scheduling a SSIS package for exporting data to flat file.
But i want to generate file names with some date information, such as foo_20140606.csv
Is it possible?
Thanks
Select your file connection in the Connection Managers, go to the Properties and click on the (...) beside expressions.
In the editor select ConnectionString from the Property column. In the Expression text box, you can enter something like "rootNameOfFile" + (DT_WSTR, 50)(DT_DBDATE)GETDATE() + ".csv"
Evaluate your expression to make sure you're getting what you expect, and voila!
you can easily give the dynamic file name for flat or csv file in SSIS package like DataFeed_{yyyyMMdd} .txt eg. DataFeed_20181212.txt. simply go to flat file connection manager property and define the expression value and in another way you can define the package level variable and this variable you can use in expression and as per environment you can able to define folder location by using configuration file .dtsconfig file
more details @ ssis dynamic file name for flat file
If you don't have SSDT and thus can't edit this with a GUI here is how you edit the SSIS package directly:
Before:
After:
With the help of expressions you can make connection dynamic.
Select your flat file connection from Connection Managers pane. In Properties pane, click on Expression(...). Then choose ConnectionString Property from drop down list and in Expression(...) put your expression and evaluate it.
Expression build -
Example expression(you need to tweak as per your requirement) -
which is giving
E:\Backup\EmployeeCount_20140627.txt
as value.Please note - You need a working flat file connection so first create flat file connection whose connectionString property is then going to be replaced automatically by expression.
You can follow these step by step articles as well.
ssis dynamically naming destination
SSIS Dynamic Flat File Connection