• RSS
  • Twitter
  • FaceBook

Welcome to ISAserver.org

Forums | Register | Login | My Profile | Inbox | RSS RSS icon | My Subscription | My Forums | Address Book | Member List | Search | FAQ | Ticket List | Log Out

Purging SQL Databases

Users viewing this topic: none

Logged in as: Guest
  Printable Version
All Forums >> [ISA Server 2004 Firewall] >> Logging and Reporting >> Purging SQL Databases Page: [1]
Login
Message << Older Topic   Newer Topic >>
Purging SQL Databases - 10.Mar.2006 3:56:32 PM   
rpalnik

 

Posts: 10
Joined: 1.Feb.2004
Status: offline
I've changed over to SQL for logging and noticed that there is no automatic procedure to purge the logs.  After some experimenting, I found that running a query like this would delete records:

use isa   
go
delete from webproxylog  
where logdate = '3/4/2006' 
go

Since I don't know any SQL, I'm a little stumped on how I would turn this into a stored procedure that would run everyday and let me delete records equal to (todays date) - (some number, maybe 7 or 10 days).

Any pointers on where to start?


Post #: 1
RE: Purging SQL Databases - 10.Mar.2006 4:03:46 PM   
ISAServerTools

 

Posts: 42
Joined: 22.Jul.2005
Status: offline
Paste the following into a query window using the log database:

create procedure uspPurge as
  set nocount on
  delete from webproxylog where logdate < dateadd(dd, -7, getdate())



to create a stored procedure called uspPurge.

Then, you can use SQL Agent to schedule it to run each night.  You can change -7 to whatever you like.

_____________________________

www.isaservertools.com

(in reply to rpalnik)
Post #: 2
RE: Purging SQL Databases - 10.Mar.2006 4:28:14 PM   
rpalnik

 

Posts: 10
Joined: 1.Feb.2004
Status: offline
Thanks!!!!!

(in reply to ISAServerTools)
Post #: 3

Page:   [1] << Older Topic    Newer Topic >>
All Forums >> [ISA Server 2004 Firewall] >> Logging and Reporting >> Purging SQL Databases Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts