generating Filenames dynamically + SSIS

Posted by Bandi under Sql Server category on | Points: 40 | Views : 1093
To generate multiple flat files for table's data by naming files dynamically ,

File Name : EmployeeDepartment_CurrentDate_FixedString.txt

Examples for the above format:

Here, the main focus of this code is to generate file names dynamically....

1. Get the Department Name from the table and store it to a user-defined variable User::FileName ( Hint: use Foreach ADO Enumerator to loop through the different departments)
2. Create Flat File Connection Manager for destination files
3. Select Properties by right-click on Flat File Connection Manager and then go to the Expression option
4. In the 'Property Expression Editor' window, set
Property : ConnectionString
Expression: "The Actual Folder Path\\" + @[User::FileName] + ".txt "
Example for the expression is: "C:\\Folder1\\Sub Folder\\"+@[User::FileName]+".txt"

4th Point is to format file names dynamically....

Comments or Responses

Login to post response