Print Page | Close Window

SQL command

Printed From: LogSat Software
Category: Spam Filter ISP
Forum Name: Spam Filter ISP Support
Forum Description: General support for Spam Filter ISP
URL: https://www.logsat.com/spamfilter/forums/forum_posts.asp?TID=5482
Printed Date: 18 December 2025 at 6:53pm


Topic: SQL command
Posted By: ssullivan
Subject: SQL command
Date Posted: 02 February 2006 at 3:43pm

In my SpamFilter I have it set to delete and email older than 14 days from the quarantine db, but there appears to be messages all the way back to 2004 in the database.  Which table in SQL will need to be deleted to reduce this size?

 

Shane




Replies:
Posted By: LogSat
Date Posted: 02 February 2006 at 5:02pm
Shane,

If SpamFilter was moved to a different server it is possible that some emails will remain in the quarantine database. This is because SpamFilter supports multiple SpamFilter servers connecting to the same database. To do this, each server keeps track of the emails it quarantined. If you move SpamFilter to a new server, the old entries will be orphaned.

You can issue SQL commands to manually delete older emails. First mark old emails for deletion with the following:

UPDATE    tblQuarantine
SET         &nb sp;    Expire = 1
WHERE     (MsgDate < '2/1/2006')

The date syntax will depend on your DB platform. For Microsoft SQL for example it's:

UPDATE    tblQuarantine
SET         &nb sp;    Expire = 1
WHERE     (MsgDate < CONVERT(DATETIME, '2001-01-01 00:00:00', 102))


Once the older emails have been tagged for deletion, issue the following command to delete them:

DELETE tblMsgs
FROM         tblMsgs INNER JOIN
                        tblQuarantine ON tblMsgs.MsgID = tblQuarantine.MsgID
WHERE     tblQuarantine.Expire <> 0





-------------
Roberto Franceschetti

http://www.logsat.com" rel="nofollow - LogSat Software

http://www.logsat.com/sfi-spam-filter.asp" rel="nofollow - Spam Filter ISP



Print Page | Close Window