Print Page | Close Window

MSSQL trigger to lower quarantine

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=6169
Printed Date: 05 February 2025 at 1:47am


Topic: MSSQL trigger to lower quarantine
Posted By: TechSquared
Subject: MSSQL trigger to lower quarantine
Date Posted: 01 August 2007 at 7:01am

Here is a trigger I had written to limit the quarantine to people that are actually checking it.  Basically it checks the DB when a line is inserted into the quarantine table and marks it to be deleted if there is not a corresponding user in the logins table.  It has saved me a ton of space for non-existent users, or users that don't check the quarantine.

IF (SELECT COUNT(*) FROM [dbo].[tblLogins], [inserted]
    WHERE [dbo].[tblLogins].[EMail] = [inserted].[EmailTo]) < 1
BEGIN
    UPDATE [dbo].[tblQuarantine]
        SET [Expire] = 1
        WHERE [QuarID] = @@IDENTITY
END

This is after an insert to the tblquarantine.  It has worked wonders for me.

Tech Squared




Print Page | Close Window