0

Automatic table cleaning after one year

in my database there is a table that collects information about discounts. But they are valid only for a year. How to make sure that all information in the table is deleted after a some time, for example, a year after it was created

Regards

1 reply

null
    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    I have this in the global scripts to delete all records in a table TempOrders after 2 years. Mine looks to test for April (the 4 in the month values - make it 1 for Jan etc)

    you should be able to teak it to suit you.

    let myDate := date(year(today()) - 2 - number(month(today()) <= 3), 4, 1);
    delete (select TempOrders where 'Order Date' < myDate);

Content aside

  • Status Answered
  • 2 yrs agoLast active
  • 1Replies
  • 125Views