My requirement is to produce one single flat file from three different datasets that should have timestamp value in the name of the file. All three datasets are from SQL server and using SQL query to take these data from source. Source type is OLEDB Source.
DataSet 1: This is a header dataset with just one single row which has different columns. First two columns are hardcoded and timestamp calculated dynamically.
+--------+----------+----------------------+--------------------+
| FileID | FileType | SourceBeginTimestamp | SourceEndTimestamp |
+--------+---------------------------------+--------------------+
| 1 | TXT | Time SSIS starts | Time SSIS Ends |
DataSet 2: Dataset that contains several columns with data. Total rows are typically 1000 to 10000.
+---------+---------+---------+---------+---------+
| Column1 | Column2 | Column3 | Column4 | Column5 |
+---------+---------+---------+---------+---------+
| | | | | |
DataSet 3: Footer dataset contains the total number of rows including Dataset1, Dataset2 and dataset3. Below example -considering Dataset2 has 1198 rows.
+-----------+----------+
| TotalRows | FileType |
+-----------+----------+
| 1200 | txt |
What I've done So Far: I used three different Dataflow tasks and flat file connection managers for each dataset. Using an expression to dynamically create the flat file names with timestamp without Seconds in it. This way, when i run the package, it'll create only one file and dump all three datasets into one single file.
The problem is, when the package runs in middle of a minute change, then there will be two files.
Expected Result: I want to combine these three flat files into one single flatfile with file name like SampleText_YYYYMMDDHHMISS.txt. I'm trying a way to use the File System Task or have the DFT to dump the data into rowset and then use script task to dump all the data into one flat file.
The output file will not have the headernames (ColumnNames)
Please suggest the best way to do it.