“mysql for excel”insert语句从excel更改值

时间:2014-07-18 16:47:23

标签: mysql excel

使用excel 2010,mysql for excel最新版本。

任务:更新现有的mysql表

问题:excel的mysql将值更改为0(零)一列

我可以预览sql语句并查找值并更改insert语句,但这不是大数据集的选项。

mysql中的destination字段设置了外键,见下文 外键设置 https://drive.google.com/file/d/0BzmA8MI6FMnwSU9ZbS1QVW94OGM/edit?usp=sharing

excel xls的图片 https://drive.google.com/file/d/0BzmA8MI6FMnwU1FzS1FYZEo5ZFE/edit?usp=sharing

mysql更新插入语句由mysql为excel创建,请参阅倒数第二个字段,如果我将0更改为1则会超过

收到以下语句的

错误是" MySQL错误1452:

Cannot add or update a child row: a foreign key constraint fails (`quickset_ptracdb`.`activitylist`, CONSTRAINT `FK_ActivityList_ClientList` FOREIGN KEY (`alClientID`) REFERENCES `clientlist` (`cltID`))"

INSERT INTO `quickset_ptracdb`.`activitylist` 
(`alID`,`alName`,`alComment`,`alUOM`,`alPrice`,`alLabCost`,`alMatCost`,`alClientID`,`alExtCode`) 
VALUES (12,'OB Add New Ca To Exist Spl Clsr','Installation of an additional copper cable in an existing non-pressurized splice. Excludes cable setup and actual splicing. Price Per Cable.',4,78.31,0,0,0,null);

将上述语句更改为:

INSERT INTO `quickset_ptracdb`.`activitylist` 
(`alID`,`alName`,`alComment`,`alUOM`,`alPrice`,`alLabCost`,`alMatCost`,`alClientID`,`alExtCode`) 
VALUES (12,'OB Add New Ca To Exist Spl Clsr','Installation of an additional copper cable in an existing non-pressurized splice. Excludes cable setup and actual splicing. Price Per Cable.',4,78.31,0,0,1,null);

0 个答案:

没有答案