Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Export 4 select-statements to 1 Flat File

Author  Topic 

Carat
Yak Posting Veteran

92 Posts

Posted - 2009-10-16 : 05:56:05
I need to export data from 4 select-statements to a single flat file.
All of the 4 select-statements have a different number of fields.

The first select-statement consists of 1 record (prefix record).
The second select-statement also consists of 1 record (document header).
The third select-statement consists of multiple records.
The fouth select-statement consists of 1 record (Trailer).

How can I produce a single Flat file containing all of the above records in an SSIS package?

I know that I can do this by using UNION and provide 1 query with all the statements but I don't want to do it this way.


YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-10-16 : 07:28:32
1. Code: Use a script task to write each recordset to a single file.
2. No code: Use the dataflow task to write to 4 separate files, and then use the Execute Process Task to merge the 4 files into a single file.

Hmm... Maybe there is another way to direct MARS output to a file in SSIS.
Or you could use BCP/SQLCMD to direct the output.

What do you think?
Go to Top of Page
   

- Advertisement -