You don't even need to use CFFile.  The database engine should be able to
write directly to a text file for you.  You could make the whole thing a
stored procedure if you wanted.

SELECT whatever
FROM table
WHERE aditional_options
OUTPUT TO file_name.txt FORMAT ASCII

The output is an ASCII format file with one row per line in the file. All
values are separated by commas, and strings are enclosed in apostrophes
(single quotes).

Your other FROMAT option is TEXT which includes the column names in your
output file, seperatd by |.

Todd Ashworth

----- Original Message -----
From: "Chris Montgomery" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, November 19, 2000 4:15 PM
Subject: RE: Flattening a relational database


> David,
>
> The way I would approach this is to write a query and then use CFFile to
> write your output to a text file.  You can do an output to screen first
> and if it looks like what you want, then do the file write.
>
> Chris Montgomery             [EMAIL PROTECTED]
>
> Web Development & Consulting http://www.astutia.com
> Allaire Consulting Partner
> 210-490-3249/888-745-7603    Fax 210-490-4692
>
>
> >-----Original Message-----
> >From: David Shadovitz [mailto:[EMAIL PROTECTED]]
> >Sent: Sunday, November 19, 2000 2:49 PM
> >To: CF-Talk
> >Cc: [EMAIL PROTECTED]
> >Subject: OT: Flattening a relational database
> >
> >
> >A client wants me to extract data from his relational database into a
> >text file.  The database contains information about movies,
> >and he wants
> >one line per movie.  I do not know how to flatten the data.
> >For example,
> >say these are the tables and fields:
> >
> >Movies: MovieID, MovieName
> >Genres: GenreID, GenreName
> >MoviesGenres: MovieID, GenreID
> >
> >And suppose the movie "Wild West" falls into genres Drama, Romance, and
> >Western.
> >
> >The client wants the single line for this movie to look like:
> >   Wild West, Drama, Romance, Western
> >
> >Any suggestions?
> >
> >Thanks.
> >-David


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to