由于做数据库移植,从MSSQL移植到MySQL,但是发现到了MySQL这边却无法执行。
如下,一条一条执行insert的时候没有问题可以正常插入,当本人一次将全部insert执行的时候就会报错:
本人使用的是navicat for mysql工具
如下,一条一条执行insert的时候没有问题可以正常插入,当本人一次将全部insert执行的时候就会报错:
本人使用的是navicat for mysql工具
INSERT INTO ky_fromdetail VALUES (replace(UUID(), "-", ""), "4028817b2db6b7d4012db6bec0440004", "设备费" , "A") INSERT INTO ky_fromdetail VALUES (replace(UUID(), "-", ""), "4028817b2db6b7d4012db6be641b0003", "设备费" , "A") INSERT INTO ky_fromdetail VALUES (replace(UUID(), "-", ""), "ff8080812dae81f0012dae95766b000b", "设备费" , "A") INSERT INTO ky_fromdetail VALUES (replace(UUID(), "-", ""), "4028817b2db6b7d4012db6be010b0002", "设备费" , "A") INSERT INTO ky_fromdetail VALUES (replace(UUID(), "-", ""), "4028817b2db6b7d4012db6be010b0001", "设备费" , "A")
错误信息
[Err] 1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near “INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012” at line 2
莫非MySQL中多条执行insert和MSSQL中不一样么?
解决方案
10
每句后面加上分号就可以了
10
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6bec0440004”, “设备费” , “A”);
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6be641b0003”, “设备费” , “A”)
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “ff8080812dae81f0012dae95766b000b”, “设备费” , “A”) ;
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6be010b0002”, “设备费” , “A”) ;
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6be010b0001”, “设备费” , “A”);
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6be641b0003”, “设备费” , “A”)
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “ff8080812dae81f0012dae95766b000b”, “设备费” , “A”) ;
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6be010b0002”, “设备费” , “A”) ;
INSERT INTO ky_fromdetail VALUES (replace(UUID(), “-“, “”), “4028817b2db6b7d4012db6be010b0001”, “设备费” , “A”);
10
和sqlserver是不一样 得加分号