加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 数据库 > MsSql > 正文

sql – 选择名为“index”的列的表

发布时间:2020-05-24 19:41:13 所属栏目:MsSql 来源:互联网
导读:我有一个名为“index”的列名表 select id, indexfrom item; 给出错误: Msg 1018, Level 15, State 1, Line 1 Incorrect syntax near ‘index’. If this is intended as a part of a table hint, A WITH keyword and parenthesis are

我有一个名为“index”的列名表

select id,index
from item;

给出错误:

Msg 1018,Level 15,State 1,Line 1 Incorrect syntax near ‘index’. If
this is intended as a part of a table hint,A WITH keyword and
parenthesis are now required. See SQL Server Books Online for proper
syntax.

如何对名为index的列进行选择?我正在使用sqlserver 2008-R2

解决方法

使用方括号引用 reserved words:
select id,[index]
from item

另见Delimited Identifiers的文档.

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读