1

i can't seem to find a solution that can allow me to delete only those rows from a data extension where "Timestamp" column has a data older than last 15 days from today and I want to do this on daily basis.

I even though about query like this

SELECT * FROM [DE_Name] WHERE 1 = 2

But i don't think this would work as it will delete all rows and i don't think i can add another condition.

Is there any way to do this by ampscript?

1 Answer 1

7

Why don't you use the standard Data Retention setting for the data extension. You could set data retention for individual records for 15 days. Any new records brought into the data extension will remain for 15 days and then get deleted.

The alternative for what you asking would be to use SQL.

1 SQL to select from source DE all records there are less than 15 days I.e. where Datediff(d, timestamp,GetUTCDate()) <= 15

Store this in a data extension e.g. temp_de

A second SQL is then used to copy from your temp to overwrite the original source. E.g. Select * from temp_de

As you will save your result as an overwrite it will effectively delete anything over 15 days.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .