Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warnings - what do these mean? 2

Status
Not open for further replies.

Nematoth

Programmer
Mar 29, 2002
48
MY
Hi there,

I am currently having a problem when importing data from a text file generated from Microsoft Outlook. It is a list of contacts in the following format:


,"Patrick","Bell",,,,,,,,,,"pb@somewhere.co.uk",,,","Deborah","Benson",,,,,,,,,,"db@somewhere.co.uk",,,
,"Matthew","Benson",,,,,,,,,,"mb@somewhere.co.uk",,,","Nicola","Best",,,,,,,,,,"nb@somewhere.co.uk",,,","Nicky","Black",,,,,,,,,,"nbl@somewhere.co.uk",,,
,"Alex","Bonthrone",,,,,,,,,,"ab@somewhere.co.uk",,,
,"Bill","Bonthrone",,,,,,,,,,"bb@somewhere.co.uk",,,
,"Odine","Bonthrone",,,,,,,,,,"ob@somewhere.co.uk",,,
,"Graham","Booker",,,,,,,,,,"gb@somewhere.co.uk",,,
,"Alistair","Brand",,,,,,,,,,"ab@somewhere.co.uk",,,

The SQL I used to load this data into the database is as follows:
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE text FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';

There are ten rows and I get ten warnings:
Query OK, 10 rows affected (0.01 sec)
Records: 10 Deleted: 0 Skipped: 0 Warnings: 10


The table I inserting into is created using this SQL:

CREATE TABLE text(
autoId MEDIUMINT NOT NULL AUTO_INCREMENT,
first_name VARCHAR(75),
last_name VARCHAR(75),
company VARCHAR(75),
b_street VARCHAR(75),
b_city VARCHAR(75),
b_region VARCHAR(75),
b_post_code VARCHAR(15),
b_country VARCHAR(75),
b_fax VARCHAR(75),
b_phone VARCHAR(75),
b_mobile VARCHAR(75),
email1 VARCHAR(75),
email2 VARCHAR(75),
email3 VARCHAR(75),
webpage VARCHAR(75),
PRIMARY KEY(autoId));

Does anyone have any idea what these warnings ccould be? I cannot run any special programs on the server as it is hosted with a hosting company on a shared server.

Thanks in advance for any advice!
 
They mean that mysql tried harder to import a bit incorrect data, so you may check resulting table if mysql was correct
 
I'd suggest you change each line and add a ; to the end of all that don't already have it (10 lines is easy right?)
Then
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE text FIELDS ENCLOSED BY'"' TERMINATED BY ',' LINES TERMINATED BY ';'; ***************************************
Party on, dudes!
[cannon]
 
Thanks for the advice guys...

I tried doing what you suggested KarveR but itmade no difference - still get ten warnings. The data looks fine when I "SELECT * FROM text;" so do you think it's ok to ignore it? I might just go ahead with it as it is.

Thomas Shearer
Web developer
 
it is OK to ignore only after checking resulting table
 
Its because your first line is terminated by ; but the field is NOT terminated - all fields should terminated with , and then lines temrinate with ;

so your first line would look like :
,"Patrick","Bell",,,,,,,,,,"pb@somewhere.co.uk",,,"www.somewhere.co.uk",;

The warnings are safe to be ignored like gheist says if you are happy the data is correct.
***************************************
Party on, dudes!
[cannon]
 
Thanks very much guys - tried all u suggested but still get ten warnings - the data's perfect though so I'll just leave it as is.

Cheers anyway.

Thomas Shearer
Web Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top