Deleting Sales Receipts - Which tables get cleared?

Jan 28, 2006 2 Replies

I need to reduce my db size...



Many have posted about the Retail Realms archiving utility. This sounds like a great app, but since I'm somewhat familiar with the db schema in RMS and know SQL, I would like to attempt it on my own.



Has anyone tried removing sales history through SQL? What tables should be cleared, does anyone have a script that they use?



I understand that a backup should be made prior to any changes :)



Paul


Paul, To see what tables are taking up all the space run this query:

------------------------- SELECT [total size KB], B.rows, O.name FROM (select sum(convert(decimal(10,0),dpages)*8129/1024) [total size KB], id FROM sysindexes group by id) A INNER JOIN sysindexes B ON A.id = B.id and B.indid in (0,1) INNER JOIN sysobjects O ON B.id = O.id WHERE B.rows 0 ORDER BY [total size KB] desc

Usually you want to reduce the size on the Journal table. Run this query to do so:

------------------------ Delete from journal where time < '10/01/05' ( Change the date to remove anything before that date)

Hope this helps, Casey Hanson New West Technologies

Process credit cards anywhere > I need to reduce my db size...

Thanks! I'll give it a try...I appreciate the help :)

Paul

"CaseyHans> Paul,

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required