CREATE PROCEDURE P_REGIE
@userName varchar(50),
@password varchar(50)
AS
DECLARE @message varchar(100),
@ov int
set @message=''
set @ov=-1
SET NOCOUNT ON
SELECT @ov=-1 from H_MEMBER WHERE LOGINNAME=RTRIM(LTRIM(@userName))
IF @@ROWCOUNT<=0
BEGIN
INSERT INTO H_MEMBER(LOGINNAME,PASSWORD) VALUES(@userName,@password)
SET @message='注册成功!'
SET @ov=0
END
ELSE
BEGIN
SET @message='已经存在相同的用户名!'
SET @ov=100
END
IF @@ERROR <> 0
BEGIN
SET @message='写入数据错误!'
SET @ov=-1
END
SELECT @message as Message,@ov as outputValue
GO
我刚开始学存储过程,所以还有很多的东西不明白!有一个小问题想一下下!
SELECT @ov=-1 from H_MEMBER WHERE LOGINNAME=RTRIM(LTRIM(@userName))
SELECT 后面跟@ov=-1是什么意思呀? 去了就不行了!