“NVARCHAR"附近的语法不正确

2021-09-10 00:00:00 sql tsql sql-server
CREATE TABLE #temptable
(
    Assessment_Component_Identifier NVARCHAR(50),
    Predecessor_Assessment_Component_Identifier NVARCHAR(50),
    Assessment_Period_Identifier NVARCHAR(50),
    [Level] TINYINT,
    Assessment_Period_dataination_Identifier NVARCHAR(50)
);

INSERT INTO #temptable
(
    Assessment_Component_Identifier NVARCHAR(50),
    Predecessor_Assessment_Component_Identifier NVARCHAR(50),
    Assessment_Period_Identifier NVARCHAR(50),
    [Level] TINYINT,
    Assessment_Period_dataination_Identifier NVARCHAR(50)
);

我收到以下错误

消息 102,级别 15,状态 1,第 11 行
'NVARCHAR' 附近的语法不正确

Msg 102, Level 15, State 1, Line 11
Incorrect syntax near 'NVARCHAR'

推荐答案

如果你想插入到 #temp 表中,那么你必须只使用列表中的列名,如下所示:

If you want to insert into #temp table then you have to use only column names in the list as follows:

INSERT INTO #temptable
(
    Assessment_Component_Identifier,
    Predecessor_Assessment_Component_Identifier,
    Assessment_Period_Identifier,
    [Level],
    Assessment_Period_dataination_Identifier
) VALUES (.....);

相关文章