Create multiple .CSV files from a single Query or SQL Select command
Posted on 2009-07-02
I'd done some SQL coding years ago, and am rusty. I recall being able to import data from .csv files, and export table data to .csv files, but I forget the syntax.
Ideally, I'd like the .csv filenames to be programmed based on the data.
A bit more detail:
I'm working in Access 2007. I need to export data to .csv files, and the filenames are dependent on three table columns (fields), say X, Y, and Z, with more columns A, B, & C.
Even more detail:
I'm thinking of an SQL Select command that will take columns (fields) A,B,C,X,Y,Z and write out the comma-delimited flat files like such:
filename: X1-Y1-Z1.csv (where X1, Y1, and Z1 equal the actual contents of those text fields)
the filename would be big-green-Wednesday.csv
And, with the header row included, the first file contents might look like this:
The next file, X1-Y1-Z2, might be named big-green-Friday.csv, and the next file, X1-Y3-Z5, might be big-yellow-Sunday.csv
This would be a huge help - I'd award more points than 500 if I could.