Hence the batching.  Do a thousand at a time.  Best of both worlds.

<cfset s = "" />
<cfloop query="get">
   <!--- append your row to 's' --->
   <cfif currentrow MOD 1000 EQ 0>
      <cffile action="append" file="..." output="#s#" />
      <cfset s = "" />
   </cfif>
</cfloop>

---
Barney Boisvert, Senior Development Engineer
AudienceCentral (formerly PIER System, Inc.)
[EMAIL PROTECTED]
voice : 360.756.8080 x12
fax   : 360.647.5351

www.audiencecentral.com

> -----Original Message-----
> From: Tony Schreiber [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2003 12:44 PM
> To: CF-Talk
> Subject: RE: csv files
>
>
> However, do NOT do that for very large (50,000+ records) reports. Write
> each line at a time. It may be counter-intuitive, but apparently,
> appending data to a variables takes exponentially longer as the variable
> grows bigger...
>
> > don't do a CFFILE ACTION="append", that'll be slow like nothing
> else.  Build
> > the entire file in memory, and then write it with a single
> CFFILE.  If your
> > memory won't handle it, then break it down into chunks (maybe a
> few hundred
> > or a thousand records each), and write those chunks to the
> file, rather than
> > each record.
> >
> > ---
> > Barney Boisvert, Senior Development Engineer
> > AudienceCentral (formerly PIER System, Inc.)
> > [EMAIL PROTECTED]
> > voice : 360.756.8080 x12
> > fax   : 360.647.5351
> >
> > www.audiencecentral.com
> >
> > > -----Original Message-----
> > > From: Costas Piliotis [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, June 05, 2003 11:47 AM
> > > To: CF-Talk
> > > Subject: RE: csv files
> > >
> > >
> > > Here.  Convert query and filename as you like:
> > >
> > > <cfquery datasource="#application.ds#" name="test">
> > > select branchid, branchname from tblbranches
> > > </cfquery>
> > >
> > > <cfoutput query="test">
> > >   <cfset myvar = "">
> > >   <cfloop list="#test.columnlist#" index="mycol">
> > >           <cfset myvar = myvar &", "& evaluate("test." & mycol)>
> > >   </cfloop>
> > >   <cfset myvar = right(myvar, len(myvar) - 1)>
> > >   <cffile action="APPEND" file="\\yvrworptest\worp\test.csv"
> > > output="#myvar#">
> > > </cfoutput>
> > >
> > > -----Original Message-----
> > > From: Michael Tangorre [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, June 05, 2003 11:31 AM
> > > To: CF-Talk
> > > Subject: csv files
> > >
> > >
> > > Shoot me dead if this has been asked and answered, but pelase respond
> > > nonetheless so that my replacement can jump right in:
> > >
> > > what is the easiest way to create a csv file from a query? What I
> > > have is a
> > > custom tag that takes a runs a query and need to genenrate a
> csv file and
> > > then save it to the server using cffile.
> > >
> > >
> > > TIA,
> > >
> > > Mike
> > >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to