Reputation: 1272
ALTER PROCEDURE dbo.ModeratorSpamDeleteComment
DECLARE @CommentID int;
AS
BEGIN
DELETE Comments
WHERE CommentsID=@CommentID
END
It says i have an incorrect syntax near "AS" and "Declare"..
I want to deliver the store procedure the CommentID parameter and execute the delete statement..
Upvotes: 1
Views: 68
Reputation: 19772
Just get rid of DECLARE:
ALTER PROCEDURE dbo.ModeratorSpamDeleteComment
@CommentID int
AS
BEGIN
DELETE Comments
WHERE CommentsID=@CommentID
END
Upvotes: 2
Reputation: 67175
Move the DECLARE
into your procedure body (between BEGIN
and END
). The area it's in now is for procedure parameters.
Upvotes: 1
Reputation: 175748
Don't DECLARE
the arguments;
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
Upvotes: 2
Reputation: 425251
ALTER PROCEDURE
dbo.ModeratorSpamDeleteComment
@CommentID INT
AS
DELETE
FROM Comments
WHERE CommentsID = @CommentID
Upvotes: 3