I have data for each week in a single table. I need to export this data to
a separate flat file for each week.
Any ideas?
DB2 SQL Query export to flat files as a function of data on each record
> I have data for each week in a single table. I need to export this data
> to a separate flat file for each week.
>
> Any ideas?
> DB2 SQL Query export to flat files as a function of data on each record
To the best of my knowledge, DB2's EXPORT command does not support what you
want to do. But you could probably use the ADMIN_CMD procedure like this:
(1) Generate the filename for a given week.
(2) Generate the SELECT statement for the data of this week.
(3) Call ADMIN_CMD to export the data selected by (2) to the file of (1).
(4) Pack the whole stuff into another procedure so that you can automate it.
Another alternative would be to roll your own UDF
(http://tinyurl.com/lu4wg). Then you can do the stuff in a single SELECT
statement.

Signature
Knut Stolze
DB2 Information Integration Development
IBM Germany