SQL Server查询错误

Web*_*net 8 sql-server

根据维基百科,这种语法看起来正确......

INSERT INTO dbo.metadata_type ("name", "publishable") 
VALUES
("Content Owner", 0),
("Content Coordinator", 0),
("Writer", 0),
("Content Type", 0),
("State", 1),
("Business Segment", 0),
("Audience", 0),
("Product Life Cycle Stage", 0),
("Category", 0),
("Template", 0)
Run Code Online (Sandbox Code Playgroud)

我收到了错误.我已经尝试将列名称包装在`但是这也不起作用......

错误代码207,SQL状态42S22:无效的列名称"内容所有者".
错误代码207,SQL状态42S22:无效的列名称"内容协调器".
错误代码207,SQL状态42S22:无效的列名称'Writer'.
错误代码207,SQL状态42S22:无效的列名称"内容类型".
错误代码207,SQL状态42S22:无效的列名称"State".

Cri*_*scu 13

在SQL Server中,字符串值由',而不是分隔".

此外,列名应该用方括号括起来,或者保持原样(如果它们不包含空格).

因此,您的查询应如下所示:

INSERT INTO dbo.metadata_type (name, publishable) VALUES
    ('Content Owner', 0),
    ('Content Coordinator', 0),
    ('Writer', 0),
    ('Content Type', 0),
    ('State', 1),
    ('Business Segment', 0),
    ('Audience', 0),
    ('Product Life Cycle Stage', 0),
    ('Category', 0),
    ('Template', 0)
Run Code Online (Sandbox Code Playgroud)