搜索
 找回密码
 加入

直接登录就可以注册id的存储过程

ctgwglzc 2008-8-30 11:29:47 1272
  1. CREATE PROCEDURE ACCOUNT_LOGIN
  2. @AccountID    varchar(21),
  3. @Password    varchar(13),
  4. @nRet        smallint    OUTPUT

  5. AS

  6. DECLARE @Nation tinyint, @CharNum smallint
  7. SET @Nation = 0
  8. SET @CharNum = 0
  9.   
  10. DECLARE @pwd varchar(13)   

  11. SET @pwd = null

  12. DECLARE @count int
  13. select @count = count(*) FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID
  14. IF @count=0
  15. Begin   
  16. INSERT INTO TB_USER (strAccountID,strPasswd,strSocNo,idays) VALUES (@AccountID,@Password,@Password,6)
  17. End  

  18. SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID and idays=6
  19. IF @pwd IS null
  20. BEGIN
  21.     SET @nRet = 0
  22.             --SET @nRet = 4
  23.     RETURN
  24. END

  25. ELSE IF @pwd <> @Password
  26. BEGIN
  27.     SET @nRet = 0
  28.             --SET @nRet = 3
  29.     RETURN
  30. END

  31. DECLARE @gokhantasci varchar(21)
  32. select @gokhantasci = count(straccountid)  FROM premium_service WHERE strAccountID = @AccountID

  33. if @gokhantasci = 0
  34. begin
  35. insert into PREMIUM_SERVICE (strAccountID, strType, nDays) VALUES (@AccountID, 1, 3)
  36. end
  37.   
  38. SELECT @Nation = bNation, @CharNum = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID   
  39. IF @@ROWCOUNT = 0
  40. BEGIN  
  41.     SET @nRet = 1
  42.     RETURN
  43. END
  44. IF @CharNum = 0
  45. BEGIN
  46.     SET @nRet = 1
  47.     RETURN
  48. END
  49. ELSE
  50. BEGIN   
  51.     SET @nRet = @Nation+1
  52.             --SET @nRet = 1  
  53.     RETURN
  54. END
  55. GO
复制代码

2 回复

longyu
2008-8-29 13:55:22
提示: 作者被禁止或删除 内容自动屏蔽
六脉神箭
2008-8-30 11:29:47
不选种族吗?
高级模式
游客