Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with an Create Procedure or Insert Statment. Error Message: "error near @Parameter Name"

CREATE PROCEDURE dbo.InsertInboxMessage
    @UserID uniqueIdentifier
    @Message nvarchar(Max)
AS 
   INSERT INTO Messages(UsersID, Messages)
   VALUES(@UserID, @Message) 

It tells me that I have an error near @Message and that I must declare the scalar @UserID.

How do I correct those errors?

like image 824
Matrix001 Avatar asked Dec 21 '22 11:12

Matrix001


2 Answers

You are missing a Comma after the first parameter declaration

CREATE PROCEDURE dbo.InsertInboxMessage
    @UserID uniqueIdentifier,   -- Comma goes here!
    @Message nvarchar(Max)
AS
   INSERT INTO Messages(UsersID, Messages)
   VALUES(@UserID, @Message)

References

  • TSQL Create Procedure Syntax
like image 163
Brian Webster Avatar answered Dec 24 '22 00:12

Brian Webster


You need a comma in between your variables.

CREATE PROCEDURE dbo.InsertInboxMessage

@UserID uniqueIdentifier,
@Message nvarchar(Max)
AS

INSERT INTO Messages(UsersID, Messages) VALUES(@UserID, @Message)
like image 20
Bryan Crosby Avatar answered Dec 23 '22 23:12

Bryan Crosby