【发布时间】:2020-01-17 11:44:16
【问题描述】:
以下代码不起作用:
INSERT INTO [dbo].[Customers]
([CustName]
,[CustSurname]
,[City])
VALUES
("Joe", "Dassen", "London")
表肯定存在,列名肯定正确。
但是,所有对象引用都带有红色下划线。指向光标显示:“无效的对象名称客户”为表名,“无效的列名 CustName”为 [CustName] 等等。
运行代码会产生错误,但错误不同:
Msg 207, Level 16, State 1, Line 19
Invalid column name 'Joe'.
Msg 207, Level 16, State 1, Line 19
Invalid column name 'Dassen'.
Msg 207, Level 16, State 1, Line 19
Invalid column name 'London'.
我使用 SQL Server 2017 Express 版本和最新的 SSMS。
【问题讨论】:
-
T-SQL 中的字符串值仅用单引号引起来。双引号用于标识符。
标签: sql-server sql-insert