[Techtalk] mysqlimport importing problems

Alain Tesio alain at onesite.org
Fri Nov 22 23:35:26 EST 2002


On Thu, 21 Nov 2002 11:55:00 -0500
Charlotte Oliver <COliver at casedesign.com> wrote:

> cmoliver at www-rt:~/CaseComputersImports$ cat AssetCategories.csv
> 1,"Computer"
> 2,"Monitor"
> 3,"Printer"
> 4,"Notebook"
> 5,"Network Hardware"
> 6,"Other"
> 7,"Non-MIS"
> 
> cmoliver at www-rt:./mysqlimport --columns=AssetCatID,AssetCategory
> --fields-optionally-enclosed-by='"' -d -p CaseComputers
> /home/cmoliver/CaseComputersImports/AssetCategories.csv

The default field separator is a tab, if you use a comma and don't specify it
(with --fields-terminated-by=...) mysql will try to put the whole line into the
first field, and the conversion raises a warning. This explains why the second
field is empty.

I usually get such a warning when trying to put a string into a char field
which is not large enough, but I'd thought an error would be raised here.

Alain



More information about the Techtalk mailing list