|
Posted by MGFoster on 04/21/06 21:31
mike wrote:
> I have a SQL based ERP package. Now I am having an issue on a
> particular table of people deleting a record (in the ERP system) and no
> one having any idea of who did it or when.
>
> So I thought I would setup a delete trigger so that when a record is
> deleted from a table it would populate a new table that I created with
> some information, doc_no, date etc... My problem is how can I get the
> new table to populate only information for the record being deleted.
>
> I did one try and it populated it with all remaining records. Ok I see
> my logic error, but realized that I don't know how or if I can populate
> it with info from the record being deleted.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Have you tried the deleted derived table?
CREATE TRIGGER WhoDeleted
ON erp_table FOR DELETE
AS
INSERT INTO audit_table (user_name, doc_no, delete_date)
SELECT CURRENT_USER, doc_no, CURRENT_TIMESTAMP
FROM deleted
GO
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBREkk74echKqOuFEgEQJupgCfUIt6dnQ/LIU5IKEZVwQXtnCCmwAAoLG8
QbqJCqJGaxnk7MbuUesxJlXt
=eI+m
-----END PGP SIGNATURE-----
Navigation:
[Reply to this message]
|