MySQL Forums
Forum List  »  Knowledge Base

Re: Load data File
Posted by: Jay Alverson
Date: October 28, 2008 10:39AM

I'm on Windows XP. I just took a folder then used the command interpreter to
dump a directory to a text file:

dir *.* > MyInfile.txt

which results in: and lines 3 & 5 are blank

Volume in drive C has no label.
Volume Serial Number is 60F4-5EDA

Directory of C:\Program Files\MySQL\data\test

10/28/2008 09:35 AM <DIR> .
10/28/2008 09:35 AM <DIR> ..
10/23/2008 12:14 PM 186 Blanks.txt
10/28/2008 09:35 AM 0 dir.txt
10/24/2008 07:50 AM 8,560 directory.frm
10/24/2008 08:07 AM 1,428 directory.MYD
10/24/2008 08:07 AM 1,024 directory.MYI
10/24/2008 07:52 AM 366 Directory.sql
10/18/2008 09:59 AM 8,834 fileinfo.frm
10/18/2008 10:22 AM 255,234 fileinfo.MYD
10/18/2008 10:22 AM 1,024 fileinfo.MYI
10/23/2008 01:07 PM 8,834 fileinfo1.frm
10/23/2008 01:07 PM 257,706 fileinfo1.MYD
10/23/2008 01:07 PM 1,024 fileinfo1.MYI
10/23/2008 01:21 PM 8,834 fileinfo2.frm
10/23/2008 01:21 PM 257,706 fileinfo2.MYD
10/23/2008 01:21 PM 1,024 fileinfo2.MYI
10/28/2008 09:32 AM 1,297 MyInfile.txt
10/24/2008 07:52 AM 1,240 MyOutfile.txt
10/24/2008 07:45 AM 294 mysql-test-1.bat
10/23/2008 05:08 PM 8,560 testtable.frm
10/28/2008 09:33 AM 1,377 testtable.MYD
10/27/2008 04:12 PM 1,024 testtable.MYI
21 File(s) 825,576 bytes
2 Dir(s) 47,690,825,728 bytes free

My table looks like:

CREATE TABLE `test`.`testtable` (
`line` char(50) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and can contain NULLs (blank lines).

I used MySQL Query Browser to execute:

LOAD DATA INFILE 'MyInfile.txt' INTO TABLE testtable FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

It loaded them all, but since my LINE field is only 50 characters, it truncated them, but they're all there.

I don't know what OS you're on or what MySQL (I'm on 5.0.67) but you might look to see if your table and fields can handle NULL data.

>

Thanks, Jay

Options: ReplyQuote


Subject
Views
Written By
Posted
5508
October 25, 2008 12:19AM
Re: Load data File
2841
October 28, 2008 10:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.