Jump to content

Recommended Posts

Posted

Hey everyone,

 

Is there a SQL query that I can execute to remove logon tracker entries over a certain age from the SQL logon tracker? Need to prevent my database filling up over time...

 

Thanks!

 

Moby

  • 2 weeks later...
Posted

Hi,

 

Any ideas at all? Does anyone fancy writing a quick SQL script to truncate the log to say, the last 1000 entries? Or is no-one else worried about their log DB/disk drive filling up eventually?

 

Ta

Moby!

Posted

Hi Nick,

 

I don't mean the SQL transaction logs.... I meant the database holding the web log. If using the free version of SQL Express, then this is limited to a certain size.

 

How to prune?

Thanks

Moby

  • 4 weeks later...
Posted

Here's the SQL Scripts, sorry for the delay:

 

USE [hap]
GO

DELETE FROM [dbo].[TrackerEvents]
     WHERE [dbo].TrackerEvents.LogonDateTime <= '1/1/12'
GO

 

and to just clear any empty logoffs

 

UPDATE [dbo].[TrackerEvents]
  SET [LogoffDateTime] = GETDATE()
WHERE [dbo].TrackerEvents.LogonDateTime <= '1/1/12' AND [dbo].TrackerEvents.LogoffDateTime is null
GO

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...