May 7, 2007 at 4:05 pm
can some one post a sample to trim a table that has more than ,say older than 30 days ?
Looking for a little sophisitcated way,
-thanks
May 7, 2007 at 4:06 pm
Trim a table..do you mean truncate?
May 7, 2007 at 5:32 pm
Sorry was not clear in my original posting.
Looking for a way to delete records in a table older than 30 days. Table does have a column with time stamps of when each row was created.
May 7, 2007 at 5:40 pm
This table must also have clustered index on that column.
No, I mean MUST have.
Then it will work very nice:
DELETE FROM dbo.Table
WHERE DateRecorded < DATEADD(dd, -30, GETDATE())
_____________
Code for TallyGenerator
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply