Re: Purge old ROWS
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 06/01/04
- Next message: Matt Tapia: "Re: linked server problems"
- Previous message: Matt Tapia: "linked server problems"
- In reply to: Rick: "Purge old ROWS"
- Next in thread: Rick Rohne: "Re: Purge old ROWS"
- Reply: Rick Rohne: "Re: Purge old ROWS"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 01 Jun 2004 21:23:42 +0200
On Tue, 1 Jun 2004 11:05:01 -0700, Rick wrote:
>looking for a script that will purge rows that are 2
>months old. I would like to run this as a Scheduled job..
Hi Rick,
Assuming your table is called MyTable and the creation date of each row is
stored in a column named CrDate, use this:
DELETE FROM MyTable
WHERE CrDate < dateadd(month, -2, getdate())
Untested - test it first, in a transaction. Rollback or commit as needed.
Don't put it in a scheduled job until you've tested it thoroughly.
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Matt Tapia: "Re: linked server problems"
- Previous message: Matt Tapia: "linked server problems"
- In reply to: Rick: "Purge old ROWS"
- Next in thread: Rick Rohne: "Re: Purge old ROWS"
- Reply: Rick Rohne: "Re: Purge old ROWS"
- Messages sorted by: [ date ] [ thread ]