AX for Retail: Manage data cleanup task in POS database
Description:
The cleanup procedures in POS are not fully implemented and therefore a small manual job can ensure that your database is not filling up with unnecessary records.
Resolution:
We create a job in SQL to run in a schedule. In this example we use 150 days. All Transactions that exceeds that date will be deleted.
The number of days depends on the frequency of the replication (P-JOB) and normally the value would be much lower like 1-5 days.
1. Go to your SQL Management studio
2. Go to Maintenance Plans
3. Create new plan and call it example DeletePOSData
4. Move over the Execute T-SQL Statement Task
5. Edit the TASK and add the delete statements
USE AXRETAILPOS DELETE FROM dbo.RBOTRANSACTIONBANKEDTENDE20338 DELETE FROM dbo.RBOTRANSACTIONINCOMEEXPEN20158 DELETE FROM dbo.RBOTRANSACTIONINFOCODETRANS DELETE FROM dbo.RBOTRANSACTIONINFOCODETRANS DELETE FROM dbo.RBOTRANSACTIONINVENTTRANS DELETE FROM dbo.RBOTRANSACTIONLOYALTYPOIN20296 DELETE FROM dbo.RBOTRANSACTIONLOYALTYPOINTTRANS DELETE FROM dbo.RBOTRANSACTIONLOYALTYTRANS DELETE FROM dbo.RBOTRANSACTIONMIXANDMATCHTRANS DELETE FROM dbo.RBOTRANSACTIONORDERINVOICETRANS DELETE FROM dbo.RBOTRANSACTIONPAYMENTTRANS DELETE FROM dbo.RBOTRANSACTIONSAFETENDERTRANS DELETE FROM dbo.RBOTRANSACTIONSALESTRANS DELETE FROM dbo.RBOTRANSACTIONSALESTRANS DELETE FROM dbo.RBOTRANSACTIONTABLE DELETE FROM dbo.RBOTRANSACTIONTENDERDECLA20165 DELETE FROM dbo.RBOTRANSACTIONVARIANTTRANS — POS log table DELETE FROM dbo.POSISLOG |
6. Edit the Job schedule and let it run every day
7. Save the Maintenance job
8. Make sure that your SQL Agent runs, so the job executes every day
Author: Kim Truelsen
Blog date: 12-2-2012