MAKE VIP USERS MUEMU


SQL Query To add Vip Account
Code:  [Select]
UPDATE MEMB_INFO SET AccountLevel = 1, AccountExpireDate = GETDATE() + 30 WHERE memb___id = 'LOGIN'


"AccountLevel = 1" is the level of the VIP is 1,2,3 
"AccountExpireDate = GETDATE () +30" = where the "30" means the days that are 30 days a month 
"LOGIN" = Account to be assigned the VIP


Query so that the days expire Automatically  (Only 1 time is used nothing else)

Code:  [Select]
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

CREDITOS 
Guide published by   @Rastaa

Comments