如果没有插入表的记录,我想检查表PREMIUM_SERVICE_USER
是否存在
strClientID
更新timeValid
+30 的记录。strClientID
premium_service_user
我究竟做错了什么?
它增加timeValid
了 +30 天,但也插入了另一行。
SELECT @pre_var = count(*)
FROM PREMIUM_SERVICE_USER
WHERE strClientID = @strClientID
/* bronze premium - 200 cash */
IF @Premium = 1
BEGIN
INSERT INTO PREMIUM_SERVICE_USER
(strClientID, timeReg, timeValid, bCurrent, durum)
VALUES
(@strClientID,getdate(),getdate() + 30,'1','1')
UPDATE TB_USER
SET cash = cash+200
WHERE strAccountID = @strClientID
END
IF @Premium = 1 AND @pre_var = 1
BEGIN
UPDATE PREMIUM_SERVICE_USER
SET timevalid = timevalid+30 where strClientID = @strClientID
UPDATE PREMIUM_SERVICE_USER
SET bCurrent = 1 where strClientID = @strClientID
UPDATE TB_USER
SET cash = cash+200 WHERE strAccountID = @strClientID
END