加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – SQL Server查询错误

发布时间:2020-12-12 06:43:32 所属栏目:MsSql教程 来源:网络整理
导读:根据维基百科,这种语法看起来正确…… INSERT INTO dbo.metadata_type ("name","publishable") VALUES("Content Owner",0),("Content Coordinator",("Writer",("Content Type",("State",1),("Business Segment",("Audience",("Product Life Cycle Stage",("Ca
根据维基百科,这种语法看起来正确……
INSERT INTO dbo.metadata_type ("name","publishable") 
VALUES
("Content Owner",0),("Content Coordinator",("Writer",("Content Type",("State",1),("Business Segment",("Audience",("Product Life Cycle Stage",("Category",("Template",0)

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

Error code 207,SQL state 42S22: Invalid column name ‘Content Owner’.
Error code 207,SQL state 42S22: Invalid column name ‘Content Coordinator’.
Error code 207,SQL state 42S22: Invalid column name ‘Writer’.
Error code 207,SQL state 42S22: Invalid column name ‘Content Type’.
Error code 207,SQL state 42S22: Invalid column name ‘State’.

解决方法

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

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

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读