sql script to purge database of old customers
Posted on 2016-07-28
so my company gives our clients a little time to hopefully come back, or ask for information from when they were a customer, however we have a cutoff, i am looking for a script to aid in this cutoff.
In A database named "subscriber"
and a table named "Subscriber Detail"
AccountID,AccountGroupCode,AcctNum, ExtraArea,MoreStuff,EvenMoreSt,Name, ...............(several more fields)
1,DR1,1234, , , ,stoped 6/25/14 bob,
2,DC,1245, , , ,ended 3/4/12 tom,
I would like to delete all lines of data in all tables within "subscriber" biased on the "AccountID" that match the following criteria
A selected "accountgroupcode".
The "name" field having a date older than 1/1/14 within it.
I would like to be able to change the date that they are older than, as i will be doing this several times throughout the year