Export using DTS | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Export using DTS

Hi, I need to export 2 table information to single fixed length flat file structure (fixed length is maximum length of both the table). There would be a field which would specify the data is from which table.
Although from top it sound simple as append the file directly from table.. but it is not. Because the two table that I want to export to single file has parent child relationship and the way record should appear is that one record of parent then all records of child for that parent and so on.. I am stuck at very begining as what is the way to proceed. One way which I am thinking is to create a temporary table which would hold the field definition of all and populate this table using normal SQL statement and then transfer to flat file. But seems very basic. Any other suggestions. Thanks and regards,
Nilay.
Did you try joining the data based on the relationship and then exporting the data into the flat file using the join query as input? This will create a bigger file but the hastels and chances of error will be less. Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

Ya.. seems good.. If I understand correctly then the result query should contain all the columns of both the table. Right.
That’s correct… So this will be one query and will generate a single file having the same file structure through out. Gaurav
Moderator
Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

]]>