ALTER PROCEDURE dbo.ModeratorSpamDeleteComment
DECLARE @CommentID int;
AS
BEGIN
DELETE Comments
WHERE CommentsID=@CommentID
END
它说我在“AS”和“声明”附近的语法不正确..
我想将存储过程传递给CommentID参数并执行delete语句..
答案 0 :(得分:3)
ALTER PROCEDURE
dbo.ModeratorSpamDeleteComment
@CommentID INT
AS
DELETE
FROM Comments
WHERE CommentsID = @CommentID
答案 1 :(得分:2)
摆脱DECLARE:
ALTER PROCEDURE dbo.ModeratorSpamDeleteComment
@CommentID int
AS
BEGIN
DELETE Comments
WHERE CommentsID=@CommentID
END
答案 2 :(得分:2)
不要DECLARE
参数;
ALTER PROCEDURE dbo.ModeratorSpamDeleteComment
( --parens are optional but clearer imo
@CommentID int
)
AS --don't need BEGIN/END in this case
DELETE FROM Comments
WHERE CommentsID=@CommentID
答案 3 :(得分:1)
将DECLARE
移到您的程序正文中(BEGIN
和END
之间)。它现在的区域是程序参数。