搜索
 找回密码
 加入

自动注册帐号密码的存储过程(免费)

tianwei76 2009-7-14 15:23:53 1433
又不是自己研究出来的,何必什么都拿来卖呢
  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. DECLARE @pwd varchar(13)

  10. SET @pwd = null

  11. SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID and idays=6
  12. IF @pwd IS null
  13. BEGIN
  14.         SET @nRet = 0
  15.              --SET @nRet = 4
  16.         RETURN
  17. END

  18. ELSE IF @pwd <> @Password
  19. BEGIN
  20.         SET @nRet = 0
  21.              --SET @nRet = 3
  22.         RETURN
  23. END

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

  26. if @gokhantasci = 0
  27. begin
  28. insert into PREMIUM_SERVICE (strAccountID, strType, nDays) VALUES (@AccountID, 1, 3)
  29. end

  30. SELECT @Nation = bNation, @CharNum = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
  31. IF @@ROWCOUNT = 0
  32. BEGIN
  33.         SET @nRet = 1
  34.         RETURN
  35. END
  36. IF @CharNum = 0
  37. BEGIN
  38.         SET @nRet = 1
  39.         RETURN
  40. END
  41. ELSE
  42. BEGIN
  43.         SET @nRet = @Nation+1
  44.              --SET @nRet = 1
  45.         RETURN
  46. END
  47. GO
复制代码

2 回复

njsun
2009-4-6 15:14:28
点击查看详情
用了,不行啊!
csywl110
2009-7-14 15:23:53
高级模式
游客