Free for PREMIUM members
[Webinar] Streamline your web hosting managementRegister Today
declare @dow int,
set @currDate = cast(getdate() as varchar(11)) -- Gets the current Date
set @DOW = (@@DATEFIRST + DATEPART(dw, GETDATE())) % 7 -- Finds out the day of week, compensating for changing the @@FirstDay parameter
set @DelDate = dateadd(d,-7+(7-@dow),@currDate) -- Sets the @DelDate to LAST friday, regardless of date run
set rowcount 1000
where LogDate < @DelDate
set rowcount 0
CAUTION... this will delete every thing older than friday of last week
So if you run it on Sunday, it will delete everything older than 2 days old.
If you run it on Friday, it will delete anything older than LAST Friday.
If you want to delete older than 7 days ago, just use the date calculation below
set @DelDate = dateadd(d,-7,@currDate)
Open in new window
Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.