ATLDBA
SSC Veteran
Points: 277
More actions
February 6, 2003 at 9:11 am
#81499
An application developer would like for an entire record to be automatically deleted after a datetime field is one year old. As a novice DBA, I'm not sure how best to approach this task. Please advise. Thanks.
Carpe diem!
Steve Jones - SSC Editor
SSC Guru
Points: 736255
February 6, 2003 at 10:46 am
#448255
Write a stored procedure to delete these.
something liek
delete x
where x.datetimefield < dateadd( y, -1, getdate())
Then schedule this to run every day or week, depending on what you need.
Steve Jones
sjones@sqlservercentral.com
http://www.sqlservercentral.com/columnists/sjones
http://www.dkranch.net
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply