USE [BILLING] GO
DECLARE @id VARCHAR(13)
DECLARE @status int
DECLARE @
Lama int
DECLARE @Cash int
DECLARE @Buy int
DECLARE @CashBuy int
/****** Account ID ******/
SET @id = 'Spike'
/****** Set Value to 2 For Active, Set Value to 1 For Deactived ******/
SET @status = '2'
/****** Long Player Get Premium Service Day, Example 1 = (1 Day) ******/
SET @
Lama = '120'
/****** Update Cash Point, Example First Cash Point 100, if add 500 result is 600 ******/
SET @Buy = '5500'
SELECT @Cash = Cash from tbl_UserStatus Where id = @id
/************************************************************************************************************************************************/
declare @count numeric(18, 0)
select @count = COUNT(*) from [BILLING].[dbo].[tbl_UserStatus] where id = @id
if @count = 0
begin
INSERT INTO [BILLING].[dbo].[tbl_UserStatus]
(
[id],
[Status],
[DTStartPrem],
[DTEndPrem],
[Cash]
)
VALUES
(
@id,
@status,
CONVERT(datetime,GETDATE()),
CONVERT(datetime,GETDATE() @
Lama),
@Cash
)
end