微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我有一个名为“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的文档.

原文地址:https://www.jb51.cc/mssql/79938.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐