fuzzyocelot
Programmer
I'm running SQL Server 2005 locally on my computer under Windows XP. I'm new to SQL Server 2005 and SSIS, although I've used SQL Server 2000 DTS for the last year. Here is my problem that I hope someone will be able to help me with.
I need to get the data from three different database tables into the same file three times with a few variations. The first table contains 3 header records. The second table contains many detail records. The third table contains 3 trailer records. I need to write the correct header record to the correct file followed by the corresponding detail records and then the corresponding trailer record. The records must be fixed length in the file. The biggest problem I'm having is that the column lengths between the header, detail, and trailer records are different. However, the total length of every record is 800 characters. So, for example, in the header records I have 14 columns and they do not "line up" with the detail or trailer columns. The detail records have 60 columns and the trailer records have 4 columns.
So far in my package, I have a flat file connection for one file. I have three data flow tasks, one for the header table, one for the detail table, and one for the trailer table. Within each data flow task is an OLE DB source connection to the database table (i.e. header table, etc.) and a flat file connection to the same file. I'm now stuck. I have no idea how to get this to work the way I need it to. I tried specifying the columns I need in the flat file connection, but I can't get it to account for the different column lengths per type of record. Also right now it's just writing everything to one record instead of multiple records because of that setting and the mapping.
The header and trailer records don't necessarily have to be in database tables. If necessary, I could generate them some other way. I hope I've provided enough information. If not, please let me know and I'll give you more information. I would really appreciate any help or advice or guidance!
Thanks!
Rebecca
I need to get the data from three different database tables into the same file three times with a few variations. The first table contains 3 header records. The second table contains many detail records. The third table contains 3 trailer records. I need to write the correct header record to the correct file followed by the corresponding detail records and then the corresponding trailer record. The records must be fixed length in the file. The biggest problem I'm having is that the column lengths between the header, detail, and trailer records are different. However, the total length of every record is 800 characters. So, for example, in the header records I have 14 columns and they do not "line up" with the detail or trailer columns. The detail records have 60 columns and the trailer records have 4 columns.
So far in my package, I have a flat file connection for one file. I have three data flow tasks, one for the header table, one for the detail table, and one for the trailer table. Within each data flow task is an OLE DB source connection to the database table (i.e. header table, etc.) and a flat file connection to the same file. I'm now stuck. I have no idea how to get this to work the way I need it to. I tried specifying the columns I need in the flat file connection, but I can't get it to account for the different column lengths per type of record. Also right now it's just writing everything to one record instead of multiple records because of that setting and the mapping.
The header and trailer records don't necessarily have to be in database tables. If necessary, I could generate them some other way. I hope I've provided enough information. If not, please let me know and I'll give you more information. I would really appreciate any help or advice or guidance!
Thanks!
Rebecca