Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Delete Record

2 posts in Trigger Last posting was on 2004-04-07 10:21:07.0Z
fiaola Posted on 2004-04-07 08:35:28.0Z
From: "fiaola" <nospambigdee72@hotmail.com>
Newsgroups: Advantage.Trigger
Subject: Delete Record
Date: Tue, 6 Apr 2004 21:35:28 -1100
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 64.75.162.50
Message-ID: <4073bfc7@solutions.advantagedatabase.com>
X-Trace: 7 Apr 2004 02:45:59 -0700, 64.75.162.50
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!64.75.162.50
Xref: solutions.advantagedatabase.com Advantage.Trigger:40
Article PK: 1136107

I'm using a trigger to archive records after delete. What I want is to
INSERT the USER NAME who deleted the Record.

Question 2: I want to keep track of all records BROWSE by a user and would
like to use TRIGGER to do this if possible.

Thanks in Advance.


Joachim Duerr (ADS Support) Posted on 2004-04-07 10:21:07.0Z
From: "Joachim Duerr (ADS Support)" <jojo.duerr@gmx.de>
Subject: Re: Delete Record
Newsgroups: Advantage.Trigger
References: <4073bfc7@solutions.advantagedatabase.com>
Organization: Extended Systems GmbH
User-Agent: XanaNews/1.16.1.9
X-Face: ,QMv7[luB)BpWAQ~:"kw6n%0ieY63.:g2K3n~8ky0;||5Xle*Xq+=~<Fy:0CVC2nx@8~vZ
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 195.2.185.25
Message-ID: <4073c803@solutions.advantagedatabase.com>
Date: 7 Apr 2004 03:21:07 -0700
X-Trace: 7 Apr 2004 03:21:07 -0700, 195.2.185.25
Lines: 27
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!195.2.185.25
Xref: solutions.advantagedatabase.com Advantage.Trigger:41
Article PK: 1136108


fiaola wrote in <4073bfc7@solutions.advantagedatabase.com> :

> I'm using a trigger to archive records after delete. What I want is
> to INSERT the USER NAME who deleted the Record.

CREATE TRIGGER myTrigger
ON mytable
AFTER DELETE
BEGIN
UPDATE __old SET moduser=(SELECT user() FROM system.iota);
INSERT INTO backup SELECT * FROM __old;
END;

> Question 2: I want to keep track of all records BROWSE by a user and
> would like to use TRIGGER to do this if possible.

There's no possibility to set up triggers on a READ operation. What you
could do is to write a Stored Procedure to populate the dataset
(instead of accessing the tables directly) and track the SQL command
with the username in a separate table.

--
Joachim Duerr
EMEA Lead ADS Support, Extended Systems GmbH, Germany
advantage[AT]extendsys.de
European Advantage Conference 2004:
http://www.extendsys.de/go/eac2004