数据库中创建了一个存储过程,执行的时候产生了一个错误,错误提示是:消息 156,级别 15,状态 1,过程 sp_Accounts_ValidateLogin,第 7 行
关键字 'SELECT' 附近有语法错误。请问错误在哪里?如何修改?
Create PROCEDURE[dbo].[sp_Accounts_ValidateLogin]
@EmailAddress varchar(255),
@Password varchar(20) AS DECLARE @UserID int,
SELECT @UserID = UserID
FROM Accounts_Users
WHERE EmailAddress =@EmailAddress and Password =@Password
IF @UserID !=NULL
RETURN @UserID
ELSE
RETURN -1
------解决思路----------------------
Create PROCEDURE[dbo].[sp_Accounts_ValidateLogin] (
@EmailAddress varchar(255),
@Password varchar(20) ) AS
DECLARE @UserID int
SELECT @UserID = UserID
FROM Accounts_Users
WHERE EmailAddress =@EmailAddress and Password =@Password
IF @UserID !=NULL
RETURN @UserID
ELSE
RETURN -1
------解决思路----------------------
@Password varchar(20) AS DECLARE @UserID int,去掉逗号
SELECT @UserID = UserID