-- execute
USE SmartStore
--USE AmarPOS
DECLARE @WorkDate NVARCHAR(30) = '2025.01.01'
,@SendedDate NVARCHAR(30) = '2025-01-01 00:00:00'
USE SmartStore
DELETE FROM Sales WHERE WorkDate < @WorkDate
DELETE FROM SalesItem WHERE WorkDate < @WorkDate
DELETE FROM Txn WHERE WorkDate < @WorkDate
TRUNCATE TABLE DeletedSalesItem
DELETE FROM Sended WHERE [date] < @SendedDate
DELETE FROM posApi3 WHERE requestDate < LEFT(@SendedDate,10)