I'm trying to import an excel file into my mysql database using CSV.
DB structure:
CREATE TABLE IF NOT EXISTS `sales_products` (
`productID` int(11) NOT NULL auto_increment,
`name` varchar(200) NOT NULL default '',
`categoryID` int(11) NOT NULL default '0',
`brandID` int(11) NOT NULL default '0',
`seriesID` int(11) NOT NULL,
`info` text NOT NULL,
`img` text NOT NULL,
`date_added` date NOT NULL default '0000-00-00',
`price` double NOT NULL default '0',
`special` varchar(200) NOT NULL,
PRIMARY KEY (`productID`),
FULLTEXT KEY `name` (`name`,`info`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='All products' AUTO_INCREMENT=21341 ;
First line of CSV:
Bottle opener (No.:015005);1;1;0;Blue, metallic;801001.gif;12-05-2012;0.95
I use 'import CSV using LOAD DATA', with following columns: name,categoryID,brandID,seriesID,info,img,date_added,price,special
It runs without errors, but the info field is left blank, the info is put into the 'img' field, img into date_added, etc. So it skipped the info field. Why is that?
我发现如果将文件另存为制表符分隔的文本(这是假设您可以使用电子表格程序对其进行修改),则可以避免误识别逗号的问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.