List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 21 2002 2:50pm
Subject:Re: Problem with LOAD LOCAL DATA INFILE
View as plain text  
You have carriage returns in your data file.
Try adding a 'terminated by'  to your load data.

compo guy wrote:

> I am using MySQL version 3.23.11-alpha on Win98. I have created a 
> database with a table borrower whose description is as follow:
>
> mysql> describe borrower;
> +---------------+-------------+------+-----+---------+-------+
> | Field         | Type        | Null | Key | Default | Extra |
> +---------------+-------------+------+-----+---------+-------+
> | customer_name | varchar(20) | YES  |     | NULL    |       |
> | loan_number   | varchar(5)  | YES  |     | NULL    |       |
> +---------------+-------------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
>
> I use the following to load the data stored in borrower.txt into the 
> table borrower :
>
> mysql> load data local infile "c:\\data\\borrower.txt" into table 
> borrower;
> Query OK, 8 rows affected (0.00 sec)
> Records: 8  Deleted: 0  Skipped: 0  Warnings: 1
>
> Case 1:
> The file borrower.txt looks like the following :
>
> Adams    L-16
> Curry    L-93
> Hayes    L-15
> Jackson    L-14
> Jones    L-17
> Smith    L- 11
> Smith    L-23
> Williams    L-17
>
> When I run a select query i get the following output :
> mysql> select * from borrower;
> +---------------+-------------+
> | customer_name | loan_number |
> +---------------+-------------+
> | Adams         | L-16        |
> | Curry         | L-93        |
>        |        | L-15
>        |n       | L-14
>        |        | L-17
> | Smith         | L- 11       |
>        |        | L-23
> | Williams      | L-17        |
> +---------------+-------------+
> 8 rows in set (0.06 sec)
>
> Case 2:
> When the contents of borrower.txt is changed to no spaces in between 
> name and loan_number :
>
> AdamsL-16
> CurryL-93
> HayesL-15
> JacksonL-14
> JonesL-17
> SmithL-11
> SmithL-23
> WilliamsL-17
>
> The data stored in the table is:
>
> mysql> select * from borrower;
> +---------------+-------------+
> | customer_name | loan_number |
> +---------------+-------------+
>     | NULL        |
>     | NULL        |
>     | NULL        |
>   | NULL        |
>     | NULL        |
>     | NULL        |
>     | NULL        |
>  | NULL        |
> +---------------+-------------+
> 8 rows in set (0.00 sec)
>
>
> Why was the data not correctly loaded into the table? Please Help me.
>
> Regards,
> Vaibhav Jha.
>
> ---------------------------------------------------------------------
> 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 <mysql-thread117747@stripped>
> To unsubscribe, e-mail 
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
Problem with LOAD LOCAL DATA INFILEcompo  guy21 Aug
  • Re: Problem with LOAD LOCAL DATA INFILEGerald Clark21 Aug