Clear Database - only keep last two years of data

So I know sql express can handle up to 10gigs of database storage. Im nowhere near that in used database space but id like to see if i can clear out old transactions and only keep the last two years worth. I have backups of everything I take a sql backup everyday so im not worried about not having the data history if i need it. I just want to clear it but not sure what command i should run to do that.

Part clear is not simple due to allot of linked tables etc. If using inventory it is even harder.
Personally what I do if I want a clear start is take a backup, create a new database, link to that, restore the backup then clear all transactional history and start fresh.
Old dB is still there if you ever did need to go back without restoring backups etc can just switch over to old dB on one terminal and check old details.
Reactivate with new database and if ever go back to old dB just use in trial mode and put up with popups.

3 Likes

My advice is ;
Backup your current database and import to again different name. ( Example ; OLD_DB )

Later create a shortcut ;

“C:\Program Files (x86)\SambaPOS5\Samba.Presentation.exe” -cs:"Data Source=127.0.0.1\SQLSAMBA; User Id=sa; Password=YourPassword; Database=OLD_DB;"

Create a shortcut again ;

“C:\Program Files (x86)\SambaPOS5\Samba.Presentation.exe” -cs:"Data Source=127.0.0.1\SQLSAMBA; User Id=sa; Password=YourPassword; Database=CURRENT_DB;"

Then reset the existing (CURRENT_DB) database. If you need to see old data run the first shortcut.

1 Like

i thought creating a new database would clear out all the menus and settings that are stored in the database… really i just want to clear out all the orders and transactions from like 2016 when i started using the system to 2018 say.

a new database would do that hence the backup.
the clear transactions database task will clear all transaction data but not menus and automation etc. Part clearing transaction data is not recommended and havn’t seen anyone do it before.

1 Like

Gotcha! Thanks for the guidance!