/*ALLANJPA FEITO PARA AJUDAR A TODOS*/
/*SENIOR PROFISSIONAL MU ONLINE*/
/*22999518600*/
Use MuOnline

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER Procedure [dbo].[WZ_GetAccountLevel]
@Account varchar(10)
AS
BEGIN

SET NOCOUNT ON
SET XACT_ABORT ON

DECLARE @CurrentAccountLevel int
DECLARE @CurrentAccountExpireDate smalldatetime

SELECT @CurrentAccountLevel=AccountLevel,@CurrentAccountExpireDate=AccountExpireDate FROM MEMB_INFO WHERE memb___id=@Account

IF(@CurrentAccountLevel <> 0 AND getdate() > @CurrentAccountExpireDate)
BEGIN
    SET @CurrentAccountLevel = 0

    UPDATE MEMB_INFO SET AccountLevel=@CurrentAccountLevel,AccountExpireDate=@CurrentAccountExpireDate WHERE memb___id=@Account
END

SELECT @CurrentAccountLevel As AccountLevel,@CurrentAccountExpireDate As AccountExpireDate

SET NOCOUNT OFF
SET XACT_ABORT OFF

END
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO