0

我还有一个问题。它仅在 MSSQL 服务器中提供:

select theme0_.id as id12_, theme0_.user as user12_, theme0_.theme as theme12_ 
from theme theme0_ where theme0_.user=1 

此查询给出错误:

关键字“用户”附近的语法不正确。

但是查询在 MySQL 服务器中正确执行。请帮我。谢谢!!

4

1 回答 1

0

这是因为USER是一个保留字SQL Server需要在查询中使用方括号进行转义[]

MySQL 保留词则不是这种情况

您的查询应如下所示

select [id] as id12_, 
[user] as user12_, 
[theme] as theme12_ 
from theme 
where [user] = 1
于 2014-11-09T13:31:41.900 回答