存储过程中的语法不正确

时间:2013-12-23 00:39:39

标签: sql sql-server linq

我已经编写了更新存储过程,这里是代码

CREATE PROCEDURE writer_update_art
    @articleid int
    @title nvarchar(50) ,
    @subject text ,
    @tag nvarchar(25),
AS
    update articles 
    set (title = @title, subject = @subject, tag = @tag) 
    where articleid = @articleid

    RETURN

但出现错误:

  

'@ title'附近的语法不正确
  '('

附近的语法不正确

2 个答案:

答案 0 :(得分:3)

您不需要SET语法的括号,而且您的逗号错位:

CREATE PROCEDURE writer_update_art
    @articleid int,
    @title nvarchar(50),
    @subject text,
    @tag nvarchar(25)
AS
    update articles set title = @title , subject=@subject , tag=@tag 
    where articleid=@articleid
RETURN

答案 1 :(得分:2)

在param列表的末尾不需要内部括号或额外的逗号(在列表中的第一个param之后需要逗号):

CREATE PROCEDURE writer_update_art
(
    @articleid int,
    @title nvarchar(50) ,
    @subject text ,
    @tag nvarchar(25)
)
AS
    update articles 
    set title = @title, 
        subject = @subject, 
        tag = @tag 
    where articleid = @articleid
RETURN
相关问题