Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'user' 附近有语法错误

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'user' 附近有语法错误。
### The error may exist in zzu/qg/mybatis/mapper/user.xml
### The error may involve zzu.qg.mybatis.mapper.findUserById-Inline
### The error occurred while setting parameters
### SQL: select * from user where id = ?
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'user' 附近有语法错误。
    

sql Server中user是关键字,

所以,在写查询语句的时候要在user上加[ ]

select * from [user] from where id=1

之前也遇到过,报的错误是:关键字'order'附近有语法错误     order也是关键字 

猜你喜欢

转载自blog.csdn.net/csdn13461916098/article/details/82810716