Snort mailing list archives

Re: MS SQL trigger


From: acv <acv () miniguru ca>
Date: Tue, 22 Sep 2009 16:40:44 -0400

        Sounds like what you want is a foreign key.

        http://msdn.microsoft.com/en-us/library/aa933119(SQL.80).aspx

Alex

On Tue, Sep 22, 2009 at 04:06:43PM -0400, Alexander Novokhatsky wrote:
Date: Tue, 22 Sep 2009 16:06:43 -0400
From: Alexander Novokhatsky <alex.ontario () gmail com>
X-Mailer: The Bat! (v3.99.24) Professional
To: snort-users () lists sourceforge net
Subject: [Snort-users] MS SQL trigger

Hello, snort community.
I'm trying to create a trigger for MS SQL snort database, but I'm a
very noob with SQL. Maybe someone can help me
There is a table event with sid, cid, signature and timestamp fields
I want to write a trigger so if something is deleted from this table
it should be deleted also from table iphdr, for example.
iphdr has cid and sid fields also, so it's the PK

Here is my trigger:

ALTER TRIGGER [dbo].[Cleanup]
ON [dbo].[event]
FOR DELETE
AS
BEGIN
     SET NOCOUNT ON;
     DELETE FROM iphdr WHERE cid = (SELECT cid FROM Deleted) AND sid=
     (SELECT sid FROM Deleted)
END

It's working perfectly but only in case I delete one entry from event
table. If I delete multiple entries it doesn't work

Could you plz help me.
-- 
Best regards,
 Alexander                          mailto:alex.ontario () gmail com


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://www.geocrawler.com/redir-sf.php3?list=snort-users

Attachment: _bin
Description:

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://www.geocrawler.com/redir-sf.php3?list=snort-users

Current thread: