I found out why my LOAD DATA INFILE did not work.

The editor I was using translated the tabs I entered to spaces. That's why my load 
data infile didn't work!
I used the following command to load the data successfully:

load data infile "test.dat" replace into table persons fields terminated by ' ' 
terminated by '\r\n';

The fields terminated argument in the load command is actually a single space - I 
changed my file to have
one single space between the ID-number and the Name instead of a tab. I have to 
specify that the lines are
terminated by '\r\n' since I'm running under Windows. The default is '\n'. I'm not 
familiar with Windows -
didn't know that the tabs I was entering would be translated.

Finally got it after trial and error. I wish there were more examples and detail in 
the manual on this
topic.

Eurico

"William R. Mussatto" wrote:

> I'm forwarding this to the list since I can't offer any more advice
> myself. ---------- Forwarded message ----------
> Date: Wed, 30 Jan 2002 19:41:32 -0500
> From: [EMAIL PROTECTED]
> To: "William R. Mussatto" <[EMAIL PROTECTED]>
> Subject: Re: Batch load of data problems
>
> I guess I didn't make myself very clear. Here's what I run:
>
> mysql < create.sql
>
> This is create.sql:
>
> use test;
> create table if not exists persons (pid mediumint unsigned not null auto_increment 
>primary key, name
> varchar(50));
> load data infile "test.dat" replace into table persons;
>
> This is test.dat, located both under the data directory and the test database 
>directory (tab-delimited):
>
> 1    Joseph
> 2    Bill
>
> The table looks like this after:
>
> select * from persons;
>
> Pid    Name
> 1       NULL
> 2       NULL
>
> I don't have Joseph and Bill in the table persons. This is the problem.
> Have any ideas?
>
> Thanks,
>
> Eurico
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to