hywz 发表于 2009-12-8 16:53:53

求 跳过重复选种族的 存储过程 ACCOUNT_LOGIN

本帖最后由 hywz 于 2009-12-8 20:58 编辑

谢谢CT的存储过程 ACCOUNT_LOGIN,十分感谢。
问题已找到,对应的TB_USER表里缺项了,补全了就可以执行该存储了。

ctgwglzc 发表于 2009-12-8 20:17:46

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

evaydd 发表于 2009-12-13 20:39:26

为什么直接进艾莫尔的界面呢?没有s的

cl1024 发表于 2009-12-15 15:41:43

恩 能不能设成第一次进去的时候可以选种族 然后再登录的时候就不用了

scott9 发表于 2009-12-16 04:49:09

謝謝.

oncewill 发表于 2010-2-5 11:15:34

为什么新创建的存储过程会提示有语法错误呢。。我用的SQL2000..

oncewill 发表于 2010-2-5 11:16:47

能看到图片么?

bully 发表于 2011-6-28 13:51:16

İ liked this procedure
页: [1]
查看完整版本: 求 跳过重复选种族的 存储过程 ACCOUNT_LOGIN