Hi, i wanna write stored proc which would delete records from dirstaging.trr.table1 and dirstaging.trr.table2 older than 90 days. the same stored proc will remove all records from dir.trr.ErrorTable where there is not a record in dir.trr.table3 and dir.trr.table4. this proc will accept variable @cleanup.
NOTE : i tried something like select all records from table1 and table2 and put them in temp table, truncate table1 and 2 and apply condition on temp table to get latest records and move them in table1 and 2.
Can i do it different way?
Thanks