关于sql查询,求教大神
为什么在一个数据库中,查询的时候,有的表名要加[],有的却不需要
[解决办法]
一般都不需要加,但是有些表名以数字开头,则必须加[].
[解决办法]
Transact-SQL reserved keywords can be used as identifiers or names of databases or database objects, such as tables, columns, views, and so on. Use either quoted identifiers or delimited identifiers. The use of reserved keywords as the names of variables and stored procedure parameters is not restricted. For more information, see Using Identifiers.
来源:http://msdn.microsoft.com/en-us/library/aa238507(v=SQL.80).aspx
因为你建的表是用了SQL Server保留关键字所以访问的时候需要用到引号或者中括号。