这是我的CSV文件,即Example.csv和我的表名是示例 -
"ePID,Title,Brand,Manufacture Part Number,SubType,Type,Category ID,Category Breadcrumb"
"74416490,Drive-Rite 231039 A/C Drive Belt Tensioner Pulley,Drive-Rite,231039,A/C Drive Belt Tensioner Pulley|Drive Belt Idler Pulley,Accessory Drive Belt System Components,38656,""eBay Motors:Parts & Accessories:Car & Truck Parts:Engines & Components:Belts, Pulleys & Brackets"""
我的SQL加载命令是 -
LOAD DATA LOCAL INFILE Example.csv REPLACE INTO TABLE `Example` CHARACTER SET utf8 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' IGNORE 1 ROWS;
我将所有数据都放到第一列。
答案 0 :(得分:0)
文件中的数据看起来不正确。
由于双引号的位置,整行被解释为一列。删除双引号或用双引号将每列括起来。
试试这个: -
ePID,标题,品牌,制造零件编号,子类型,类型,类别ID,类别,面包屑 74416490,Drive-Rite 231039 A / C传动皮带张紧轮,Drive-Rite,231039,A / C传动皮带张紧轮|传动皮带惰轮皮带,附件驱动皮带系统组件,38656,eBay电机:零件和零件;配件:Car&卡车零件:发动机和零件组件:皮带,皮带轮和括号