在SQL Server 2014 Management Studio中更新表[保留]

问题描述 投票:-2回答:1

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS93Mnd6dS5wbmcifQ==” alt =“在此处输入图像描述”>

我有一个名为Classes的表,其中的列为ClassID, ClassCode, ClassName, Description,并且在试图向其中插入值的地方出现此错误

Msg 102,第15级,状态1,第3行“会计”附近的语法不正确。

Msg 911,第16层,状态1,第3行数据库“帐户”不存在。确保正确输入名称。

我无法弄清楚我做错了什么。

我尝试重新键入以匹配我在演讲中写下的示例,但我似乎无法正确地做到这一点。

INSERT INTO Classes (ClassCode, ClassName, Description)
VALUES (‘ACCT306’, Accounting 1’, This course introduces accounting concepts and explores the accounting environment. It covers the basic structure of accounting, how to maintain accounts, use account balances to prepare financial statements, and complete the accounting cycle. It also introduces the concept of internal control and how to account for assets.’)

我只需要为此更新ClassCodeClassNameDescription列,我还有很多工作要做,但是在这一项的帮助下,它以后应该会为我提供更多帮助,所以我可以知道我在做什么在这里错了。

sql-server updating
1个回答
0
投票

看来您是在文字处理程序中而不是在标准文本编辑器中键入查询。我认为是这种情况,因为您的报价正像‘ACCT306’而不是'ACCT306'一样变为“开引号”和“闭引号”。尝试使用简单的文本编辑器。在Windows中,我喜欢“ Notepad ++”,可以在这里找到:

https://notepad-plus-plus.org/

或使用任何简单的文本编辑器(记事本),或直接在SSMS中键入内容,而不是剪切和粘贴。您的查询应类似于:

    INSERT INTO Classes (ClassCode, ClassName, Description)
    VALUES ('ACCT306', 'Accounting 1', 'This course introduces accounting concepts and explores the accounting environment. It covers the basic structure of accounting, how to maintain accounts, use account balances to prepare financial statements, and complete the accounting cycle. It also introduces the concept of internal control and how to account for assets.')
© www.soinside.com 2019 - 2024. All rights reserved.