By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

Trigger Before Insert or Update

P: 1
I've created an ASP gridview and made it editable. It displays the information that was entered into a SQL table plus a time stamp and the submitter's user ID.

In the event information is edited on a specific row, I need to overwrite the time stamp, and requestor on that row to show who edited the entry.

I've found this example of a trigger for oracle but don't know how to modify it to work with SQL.

CREATE OR REPLACE TRIGGER "TR_SAMPLE"
BEFORE INSERT OR UPDATE
ON table
FOR EACH ROW
BEGIN
IF INSERTING
THEN
:new.vpreparedby := NVL (:new.vpreparedby, USER);
:new.dentrydate := NVL (:new.dentrydate, SYSDATE);
ELSE
:new.vmaintainedby := NVL (:new.vmaintainedby, USER);
:new.dmaintaineddate := NVL (:new.dmaintaineddate, SYSDATE);
END IF;
END;
Apr 15 '09 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Here, read this


--- CK
Apr 24 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.