Brian Brant
SSC Eights!
Points: 839
More actions
April 13, 2005 at 7:55 am
#61855
How would I setup a T-SQL statement that would automatically delete data that is 18 months (or older)? I can do it by manually coding a date in my delete statement but I'd like to have it automated.
Any advice is appreciated.
Thanks,
Brian
Ninja's_RGR'us
SSC Guru
Points: 294069
April 13, 2005 at 7:58 am
#552413
Delete from dbo.YourTable where DateCol < DateAdd(m, -18, getdate())
You can then run this in a job whenever you need (just schedule de job to run whenever necessary).
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply