oh my god this should be so easy

admin

Administrator
Staff member
Ok, so here's the deal:
1000 records are downloaded from Dun & Bradstreet into a .csv file (from their "Million Dollar Database"). This CSV file is checked in a txt editor: 1000 lines, comma sep. w/ quotes.

Next, the file is opened in excel and a new column is added, bringing the total column number to 151. still, 1000 lines.

Next, the file is exported as TAB-DELIMITED, with double-quotes around fields w/ commas (just what Excel does). The file is given a .txt extension.

Next, the TXT file is opened in a txt editor and verified: 1000 lines.

Next, a sql query is run : LOAD DATA INFILE blah.txt (with the proper options here).

Next, the table is verified: 1000 lines (you'll see where I'm going in a second).

Next, the table is exported: SELECT * INTO OUTFILE (with proper options here).

Finally, the exported txt file is checked in a text editor: 1970 lines!!!!

IF I use SELECT * INTO OUTFILE, I get 1970 lines (damn!). If I use a php while-loop to create a txt file, I get 2941 lines (damn!). If I export using a php-based mysql_query("select * into outfile") I get 1971 lines (damn!)

Anyone know why my data is wrapping? When I look at the exported files, or even look on screen (mind you, 151 fields is a ***** to look at on screen), I see that about 2/3 through the records the line wraps.

When using the PHP method, I check each row for \n and clear any out. That doesn't work tho.

Anyone??? I've been banging my head on this for two weeks now. I'm getting very expensive on this project!

Thanks!
 
Back
Top