Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了名为“Departure _Date”的列,但它会自动更改为“[Departure _Date]”(不在使用 SQL Server Management Studio 的查询中)。如果我从列名中删除空格,则没有问题。谁能详细解释一下。。
推断列名称周围的方括号。即使你看不到他们,他们也总是真的在那里。
在列名和某些关键字中使用空格时,在引用列时需要更频繁地使用方括号,包括在表格生成脚本和设计界面中。
从 myTable 中选择出发日期
例如,如果没有方括号,此 SQL 语句将选择“Departure”字段并返回别名“_Date”。
即使使用列名 Departure_Date,该列在 SQL 语句中也可以称为 [Departure_Date] 或 Departure_Date。