数据库SQLServer怎么转MySQL数据库

这篇文章主要讲解了“数据库SQLServer怎么转MySQL数据库”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“数据库SQLServer怎么转MySQL数据库”吧!

创新互联公司服务项目包括南溪网站建设、南溪网站制作、南溪网页制作以及南溪网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,南溪网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到南溪省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

bug简述:sql由SQLServer转换成MySQL后,navicat下可以执行,项目中却报错。

报错如下:

数据库SQLServer怎么转MySQL数据库

1-1


### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'Create TEMPORARY TABLE temp_table3

select * from (

select * from VIEW_UserMe' at line 2

### The error may exist in XX/XXX/XXXX/XXXXX/mapper/XXXXXMapper.xml

### The error may involve defaultParameterMap

### The error occurred while setting parameters

### SQL: Drop TEMPORARY TABLE IF exists temp_table3; Create TEMPORARY TABLE temp_table3 select * from ( select * from VIEW_UserMeter where supplierID =1 and SampleTime between date_sub(NOW(),interval 1 day) and date_add(NOW(),interval 1 day) ) as a; select * from (SELECT ROW_NUMBER() OVER ( ORDER BY sampleTime ) AS rownumber , building,entrance,doorplate,village,userName,remark1,remark2,meterId,meterSize,total,pressure,flowRate,valveStatus,status,updateTime,timeInp,vol,operate_ValveStatus,sampleTime,t1Inp FROM temp_table3 ) cc WHERE cc.rownumber > 0 limit 50; Drop TEMPORARY TABLE IF exists temp_table3;

### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'Create TEMPORARY TABLE temp_table3

select * from (

select * from VIEW_UserMe' at line 2

; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'Create TEMPORARY TABLE temp_table3

select * from (

select * from VIEW_UserMe' at line 2

.....................................................


将sql粘出执行,如下图,可成功执行,查询出结果,排除转换出错的可能:

数据库SQLServer怎么转MySQL数据库

1-2

回过头查看控制台error:

### The error may involve defaultParameterMap

### The error occurred while setting parameters

考虑到是不是MyBatis不支持在XML配置的SQL中带有分号“;”。

经查询,开启了allowMultiQueries=true,MyBatis即可支持批量处理sql.

如下图:

数据库SQLServer怎么转MySQL数据库

1-3

重新启动项目,可成功执行,问题解决。

感谢各位的阅读,以上就是“数据库SQLServer怎么转MySQL数据库”的内容了,经过本文的学习后,相信大家对数据库SQLServer怎么转MySQL数据库这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


文章题目:数据库SQLServer怎么转MySQL数据库
URL地址:http://scyanting.com/article/gocesh.html