mysqlimport problem

This is a discussion on mysqlimport problem within the MySQL Database forums, part of the Database Forums category; Hello, I am new to SQL and the MySQL server so I purchased a book, in a chapter it shows ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-24-2007
mattgyver83
 
Posts: n/a
Default mysqlimport problem

Hello,

I am new to SQL and the MySQL server so I purchased a book, in a
chapter it shows you how to import data with the mysqlimport tool. In
their example it works, for me it doesnt. (this is also a v4.0 book and
i am using 5.0)

It asks you to create a database, define the table master_name
CREATE TABLE master_name (
name_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
name_dateadded DATETIME DEFAULT '0000-00-00 00:00:00',
name_datemodified DATETIME DEFAULT '0000-00-00 00:00:00',
firstname varchar(75),
lastname varchar(75),
INDEX idx_fn (firstname)
INDEX idx_ln (lastname)
);

Then create a text file containing the data for this table to import
with mysqlimport.

The Text file looks like so,

:::::::::"John":::"Doe"
:::::::::"Albert":::"Smith"
:::::::::"Jimmy":::"Carr"
:::::::::"Anna":::"Bell"
save it as master_name.txt

Then run in mysql import
mysqlimport -L -u user -ppass --fields-terminated-by=:::
--fields-enclosed-by=\" contactdb c:\\master_name.txt
they show this working correctly with 0 errors 0 warnings. however
when you actually run their example it errors and says the following;

MYSQLIMPORT: Error: Incorrect integer value: '' for column 'name_id' at
row 1, when using table: master_name

when you try in the monitor it works, but bleeds 2 records together.

I was able to get it by updating the txt file to end with ::: at the
end of each record then it put all the information correctly however it
prompts with about 7 warnings. Is this just bad coding on the part of
the author or is there something that I just dont know.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:20 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0