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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |