Đây là Script clear log database dành cho ae muốn dọn dẹp dữ liệu, ae muốn dùng tốt hãy tự sử dụng và thay thế cho phù hợp với Database của mình nhé.
GO
USE [eBankGame.LuckyDiceDB]
DECLARE @_CountNoDelete BIGINT = 14400
DECLARE @_SessionId BigInt
Select @_SessionId = MAX(SessionId) From Sessions
delete [User.Bet.Balance] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet.Even] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet.Odd] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet] where SessionID < @_SessionId
GO
USE [eBankGame.SicBoLiveDB]
DECLARE @_CountNoDelete BIGINT = 14400
DECLARE @_SessionId BigInt
Select @_SessionId = MAX(SessionId) From Sessions
delete [User.Bet.Even] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet.Odd] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet] where SessionID < @_SessionId
GO
USE [eBankGame.LuckyDiceDB]
DECLARE @_CountNoDelete BIGINT = 14400
DECLARE @_SessionId BigInt
Select @_SessionId = MAX(SessionId) From Sessions
delete [User.Bet.Balance] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet.Even] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet.Odd] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet] where SessionID < @_SessionId
GO
USE [eBankGame.SicBoLiveDB]
DECLARE @_CountNoDelete BIGINT = 14400
DECLARE @_SessionId BigInt
Select @_SessionId = MAX(SessionId) From Sessions
delete [User.Bet.Even] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet.Odd] where SessionID < @_SessionId - @_CountNoDelete
delete [User.Bet] where SessionID < @_SessionId