简体   繁体   中英

incorrect syntax near '=' error on sql server

I am using just creating PROCEDURE and calling the procedure.

CREATE PROCEDURE ActiveUser @UserID int
AS
SELECT * FROM UserInfo WHERE UserID = @UserID;

EXEC ActiveUser UserID = "1"

But get this error

Incorrect syntax near '='

Actually correct syntax is

If you direct calling this:

    EXEC ActiveUser 1

or

    EXEC ActiveUser @Userid = 1

Or if by passing parameter

  declare @par int = 1
  EXEC ActiveUser @par 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM