mybatis分页时报错, '@P0' 附近有语法错误
来源:互联网 发布:手机声场测试软件 编辑:程序博客网 时间:2024/04/27 21:38
### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。### The error may exist in com/shboka/gos/mapper/BaseinfoMapper.xml
### The error may involve com.shboka.gos.mapper.BaseinfoMapper.getGoods-Inline
### The error occurred while setting parameters
### SQL: select top ? * from base_goodsinfo where (goodsid not in (select top (?*?) goodsid from base_goodsinfo order by goodsid)) order by goodsid
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
; bad SQL grammar []; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
### The error may exist in com/shboka/gos/mapper/BaseinfoMapper.xml
### The error may involve com.shboka.gos.mapper.BaseinfoMapper.getGoods-Inline
### The error occurred while setting parameters
### SQL: select top ? * from base_goodsinfo where (goodsid not in (select top (?*?) goodsid from base_goodsinfo order by goodsid)) order by goodsid
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
; bad SQL grammar []; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
我的SQL语句
SELECT TOP #{pageSize} *
FROM BASE_GOODSINFO
WHERE (GOODSID NOT IN
(SELECT TOP (#{pageSize}*#{page}) GOODSID
FROM BASE_GOODSINFO
ORDER BY GOODSID))
ORDER BY GOODSID
解决方法:select top ${pageSize}....
将#改成$就Ok了.
0 0
- mybatis分页时报错, '@P0' 附近有语法错误
- mybatis分页时报错, '@P0' 附近有语法错误
- sqlserver mybatis分页, '@P0' 附近有语法错误
- mybatis sqlserver 分页查询报错:'@P0' 附近有语法错误
- mybatis使用sqlserver分页报'@P0' 附近有语法错误。
- mybatis 动态SQL '@P0' 附近有语法错误
- '@P0' 附近有语法错误
- '@P0'附近有语法错误
- '@P0' 附近有语法错误
- 【问题解决】MyBatis分页查询SQL Server2008时出现'@P0' 附近有语法错误
- sqlserver @P0附近有语法错误
- MyBatis错误:'@P0' 附近有语法错误。] with root cause
- java.sql.SQLException: '@P0' 附近有语法错误
- myibatis中出现“@P0' 附近有语法错误。”
- myBatis 使用Select top 动态参数出现“´@P0´ 附近有语法错误”的解决
- myBatis 使用Select top 动态参数出现“´@P0´ 附近有语法错误”的解决
- myBatis 使用Select top 动态参数出现“′@P0′ 附近有语法错误”的解决
- JSP com.microsoft.sqlserver.jdbc.SQLServerException: '@P0' 附近有语法错误。
- 不重复随机数列生成算法
- gem install显示错误(Gem::RemoteFetcher::FetchError)
- 几点自己了解的东西
- 雇佣问题
- Django 学习 2 MODEL数据建模
- mybatis分页时报错, '@P0' 附近有语法错误
- 网络编程 TCP
- Android 用户界面【level 1】
- 代码大全2-用隐喻来更充分地理解软件开发
- JPA 注解 OneToMany和ManyToOne
- ios 判断小数点. 后几位 && 小数点后有数据显示数据,没有则不显示数据
- Linux性能优化大师——互动出版网
- Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat
- allowInvalidCertificates