Complicated Export To Text

G

GFB45202

I need to export data from a query. Based on the results in one of the
columns, I need to create a text file for each change in one of the columns.
The data (from HEADER2 example) is dynamic, so hardcoding is not an option.

Is there a way to automate this export?

Query Results

HEADER1 HEADER2
ABC OHIO
ABC UTAH
DEF UTAH
XYZ TEXAS
LMN TEXAS
GHI TEXAS


Desired output will be three files.

File 1 will be OHIO.txt.

File will contain:

HEADER1 HEADER2
ABC OHIO


File 2 will be UTAH.txt.

File will contain:

HEADER1 HEADER2
ABC UTAH
DEF UTAH


File 3 will be TEXAS.txt.

File will contain:

HEADER1 HEADER2
XYZ TEXAS
LMN TEXAS
GHI TEXAS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top