为什么在一个数据库中,查询的时候,有的表名要加[],有的却不需要

解决方案 »

  1.   

    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保留关键字所以访问的时候需要用到引号或者中括号。
      

  2.   

    哦,知道了,谢谢
    另外不建议用SQL SERVER保留关键字。