Re: Why does 'SELECT * FROM countries' truncate characters and SELECTcountry FROM countries does not ? PRS wrote:
> Why does 'SELECT * FROM countries' truncate characters and SELECT country
> FROM countries does not ?
>
>
> mysql> SELECT * FROM countries;
> +-------------+-----------+
> | country | capital |
> +-------------+-----------+
> |ghanistan | Kabul
> |lbania | Tirane
> |Algeria | Algiers
'country' isn't truncated. 'capital' ends with a '\r' (carriage return)
character.
> mysql> LOAD DATA LOCAL INFILE 'c:\countries.csv' INTO TABLE countries
> -> FIELDS TERMINATED BY ',';
Add 'LINES TERMINATED BY' (see mysql docs)
where you put '\r\n' when the file was created on a windows platform, or
'\n' when created on a unix platform.
Probably the file was created on a windows platform and read into a unix
platform, so that the \r that windows adds to the end of the file is
still in the 'capital' field.
Bart |