求 跳过重复选种族的 存储过程 ACCOUNT_LOGIN
本帖最后由 hywz 于 2009-12-8 20:58 编辑谢谢CT的存储过程 ACCOUNT_LOGIN,十分感谢。
问题已找到,对应的TB_USER表里缺项了,补全了就可以执行该存储了。 CREATE PROCEDURE ACCOUNT_LOGIN
@AccountID varchar(21),
@Password varchar(13),
@nRet smallint OUTPUT
AS
select @nRet = count(straccountid) from tb_user where straccountid = @AccountID
if @nRet = 0
begin
RETURN
end
select @nRet = strAuthority from tb_user where straccountid = @AccountID
if @nRet = 255
begin
set @nRet=4
return
end
DECLARE @Nation tinyint, @CharNum smallint
SET @Nation = 0
SET @CharNum = 0
DECLARE @pwd varchar(13)
set @pwd=null
SELECT @pwd = strPasswd FROM . WHERE strAccountID = @AccountIDandidays>0
IF @pwd IS null
BEGIN
--SET @nRet = 0
SET @nRet = 4
RETURN
END
ELSE IF @pwd <> @Password
BEGIN
--SET @nRet = 0
SET @nRet = 3
RETURN
END
SELECT @Nation = bNation, @CharNum = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @@ROWCOUNT = 0
BEGIN
SET @nRet = 1
RETURN
END
IF @CharNum = 0
BEGIN
SET @nRet = 1
RETURN
END
ELSE
BEGIN
SET @nRet = @Nation+1
END
DECLARE @premiumExpire datetime,@nDays int
DELETE FROM PREMIUM_SERVICE WHERE strAccountID = @AccountID
SELECT @premiumExpire=premiumExpire FROM TB_USER WHERE strAccountID = @AccountID
IF @premiumExpire IS NOT NULL
BEGIN
SET @nDays = DateDiff(d, getDate(), @premiumExpire)
IF @nDays>0
INSERT INTO PREMIUM_SERVICE(strAccountID,strType,nDays) VALUES(@AccountID,4,@nDays)
END
GO
为什么直接进艾莫尔的界面呢?没有s的 恩 能不能设成第一次进去的时候可以选种族 然后再登录的时候就不用了 謝謝. 为什么新创建的存储过程会提示有语法错误呢。。我用的SQL2000.. 能看到图片么? İ liked this procedure
页:
[1]