473,508 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does 'SELECT * FROM countries' truncate characters and 'SELECT country FROM countries' does not ?

PRS
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
mysql> SELECT country FROM countries;
+-------------+
| country |
+-------------+
| Afghanistan |
| Albania |
| Algeria |
+-------------+
3 rows in set (0.00 sec)


c:\countries.csv

Afghanistan, Kabul
Albania, Tirane
Algeria, Algiers

mysql> LOAD DATA LOCAL INFILE 'c:\countries.csv' INTO TABLE countries
-> FIELDS TERMINATED BY ',';
Query OK, 3 rows affected (0.00 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 0

countries TABLE
country VARCHAR(30) NOT NULL
capital VARCHAR(50) NOT NULL
Dec 7 '05 #1
2 1817
I`ve often used mysql, but never heard about that. sounds like a bug or
something...

which version did you use?
Try the same with a different version.
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
mysql> SELECT country FROM countries;
+-------------+
| country |
+-------------+
| Afghanistan |
| Albania |
| Algeria |
+-------------+
3 rows in set (0.00 sec)


c:\countries.csv

Afghanistan, Kabul
Albania, Tirane
Algeria, Algiers

mysql> LOAD DATA LOCAL INFILE 'c:\countries.csv' INTO TABLE countries
-> FIELDS TERMINATED BY ',';
Query OK, 3 rows affected (0.00 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 0

countries TABLE
country VARCHAR(30) NOT NULL
capital VARCHAR(50) NOT NULL

--

visit: http://www.h4xx0r.ch
Dec 7 '05 #2
On Wed, 7 Dec 2005 04:42:06 -0600, in mailing.database.mysql "PRS"
<sw*****@comcast.net> 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
|
|
| mysql> SELECT country FROM countries;
| +-------------+
| | country |
| +-------------+
| | Afghanistan |
| | Albania |
| | Algeria |
| +-------------+
| 3 rows in set (0.00 sec)
|
|
|
|
| c:\countries.csv
|
| Afghanistan, Kabul
| Albania, Tirane
| Algeria, Algiers
|
| mysql> LOAD DATA LOCAL INFILE 'c:\countries.csv' INTO TABLE countries
| -> FIELDS TERMINATED BY ',';
| Query OK, 3 rows affected (0.00 sec)
| Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
|
| countries TABLE
| country VARCHAR(30) NOT NULL
| capital VARCHAR(50) NOT NULL


Try giving the load data function some more information:

LOAD DATA LOCAL INFILE 'c:\\countries.csv' INTO TABLE countries FIELDS
TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';

or

LOAD DATA LOCAL INFILE 'c:\\countries.csv' INTO TABLE countries FIELDS
TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY
'\r\n';
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Dec 7 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4256
by: John C | last post by:
I am working with an HTML-based form that uses a select element that requires about 200 options. Is there a way that I can load, or select one of these options from a file, rather than hardcode...
15
2717
by: grunar | last post by:
After some thought on what I need in a Python ORM (multiple primary keys, complex joins, case statements etc.), and after having built these libraries for other un-named languages, I decided to...
0
1259
by: aPRSComp | last post by:
Hi, Has anyone seen where using SELECT * truncates characters ? mysql> SELECT * FROM countries; +-------------+-----------+ | country | capital | +-------------+-----------+...
9
2513
by: Udo Marx | last post by:
Greets to ciwah! I'm doing a little webproject for a local session event. Tryin' to meet latest standards i failed to do this: --snip-- <select name="fromcountry" accesskey="l" title="+">...
6
2759
by: Samuel Shulman | last post by:
Hi I wander how can I get the a list with all countries and the 2 characters country alphabetic code etc. Thank you, Samuel Shulman
1
256
by: Mr. SweatyFinger | last post by:
I have a gridview and a sqlserver datasource. I also have a dropdownlist of countries. The gridview displays a bunch of crap about whatever country is selected in the countries dropdownlist I...
7
3492
by: mcha226 | last post by:
Hi All I have to build a page which includes a select element (as a drop down menu) with all the country names in it. However I just found out that the need to be repeated many times so the...
6
2198
by: patrick.waldo | last post by:
Hi all, I'm analyzing some data that has a lot of country data. What I need to do is sort through this data and output it into an excel doc with summary information. The countries, though,...
3
3871
by: fishctr | last post by:
Hi There, I am creating a survey that asks users what countries they have worked in, and which regions in those countries. Because there can be many answers, I was thinking I could populate a...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.