Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine the size of an exported CSV file 1

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi all

Can anyone please suggest how to accomplish the following:

I am creating several CSV files that are eventually uploaded via phpadmin.
Code:
COPY TO filename.csv DELIMITED
The maximum size of the upload file allowed is about 2mb.

There can be anything from 20,000 to 200,000 records within the table that are exported to the above CSV file.

I am trying to break down the size of the exported file to create multiple files so they are no larger than 2mb.

As a guide, a CSV containing 15,000 records is around the 2mb mark.

I would like the files for example....

file1.csv
file2.csv
file3.csv
file4.csv

Etc....

How can I achieve this?

Many thanks
Lee


Windows XP
Visual FoxPro Version 6 & 9
 
If you know that 15000 records are 2MB you can do sometrhing like:
Code:
lnLoop = CEILING(RECCOUNT()/15000)
FOR lnFor = 1 TO lnLoop
    lcFileName = [Test]+TRANSFORM(lnFor)+[.CSV]
    COPY TO (lcFileName) NEXT 15000 DELIMITED
NEXT

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top