我存储的程序在本地mssql中正确编写,但在godaddy mylittleadmin中没有

时间:2018-04-11 17:09:09

标签: sql-server

  

这是我在本地mssql服务器上执行时登录的sql代码   工作正常,但当我在godaddy的mylittleadmin执行时不是

alter proc  [dbo].[Loginuser] 
 @Username nvarchar(100),
 @Password nvarchar(100)

as 
begin 

Declare @Retrycount int
Declare @count int
Declare @Accountlocked bit
Declare @Rolename nvarchar(20)

select @Accountlocked = Islocked 
  from tbl_Userinfo where Email = @Username
if(@Accountlocked = 1)
begin
select 1 as Accountlocked ,0 as authenticated,0 as Retryattempts
end
else
begin
select @count = count(Email) from tbl_Userinfo where Email=@Username and [Password]=@Password

if(@count=1)
    begin
 update  tbl_Userinfo set Retryattempts = 0 
 where Email = @Username
 select 0 as Accountlocked,1 as authenticated,0 as Rertyattempts

UPDATE tbl_Userinfo
        SET LastLogin =  GETDATE()
        WHERE Email = @Username

SELECT @Rolename = RoleName FROM tbl_Roles  WHERE RoleId = (select RoleId from tbl_Userinfo where Email=@Username and [Password]=@Password)

SELECT 1 as [ReturnCode], @Username as [Uname], @Rolename as [Roles] 

end
 else
begin
select @Retrycount = IsNull(Retryattempts,0)
  from tbl_Userinfo  where Email = @Username
set @Retrycount=@Retrycount+1
if(@Retrycount <= 3)
    begin
  update  tbl_Userinfo set Retryattempts = @Retrycount
  where Email = @Username
  select 0 as Accountlocked,0 as authenticated,@Retrycount as  Retryattempts
    end

 else
    begin
update tbl_Userinfo set Retryattempts = @Retrycount,
 Islocked = 1,Lockeddatetime = GETDATE()
 where Email = @Username
 select 0 as Accountlocked,0 as authenticated,0 as Retryattempts
  end
  end
  end
  end

this is output i want

我想在给定的图像中输出,但是当我在godaddy的mylitleadmin中执行它时,它在本地mssql服务器中正常工作它在Roles列中返回null This is role table

  

请帮我解决方案。

0 个答案:

没有答案