SQL Query Para agregar Cuenta Vip
Code: [Select]
UPDATE MEMB_INFO SET AccountLevel = 1, AccountExpireDate = GETDATE() + 30 WHERE memb___id = 'LOGIN'
"AccountLevel = 1" es el level del VIP sea 1,2,3
"AccountExpireDate = GETDATE() +30"= donde esta el "30" significan los días osea 30 días un mes
"LOGIN" = Cuenta que se asignara el VIP
"AccountExpireDate = GETDATE() +30"= donde esta el "30" significan los días osea 30 días un mes
"LOGIN" = Cuenta que se asignara el VIP
Query para que expiren los días Automáticamente (Solo se usa 1 Vez nada mas)
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
Guia publicada por @Rastaa