Link to home
Start Free TrialLog in
Avatar of garyinmiami2003
garyinmiami2003Flag for United States of America

asked on

Simple archive trigger for SYBASE table

If TableA has 3 columns: Col1, Col2, Col3.   and I want to create a row in an archive table (tbl_arch), for the Old part of a change operation:

My guess that it would look something like:

CREATE TRIGGER LOGCHANGES1 NO CASCADE BEFORE UPDATE ON dbo.TableA REFERENCING OLD AS O
    FOR EACH ROW
INSERT INTO dbo.tbl_arch  VALUES
(O.Col1, O.Col2, O.Col3, "O")
I think this is what it would look like in db2, what would it look like in sybase?

I need to capture the  date and time stamp (just the system date & time) &  load date.
Can you correct the trigger and complete the definition of the table for system generated fields I am looking for (user, date-time-stamp, load date)

TableA
Col1    char(1)
Col2   char(2)
col3  char(3)
DateTime  ?
Load date

 My question:   Review the trigger and correct any syntax, and complete the table. Provide the system variable name in sybase for the time stamp and load date.  Anything close and I'll award the points.

 
Avatar of Joe Woodhouse
Joe Woodhouse

Which Sybase product and version? They have mutiple database products... `
Avatar of garyinmiami2003

ASKER

version 12.5   32bit open client
Will you laugh if I say at least two of the database products from Sybase have a version 12.5? 8-)

I'm guessing you're talking about ASE but there is also a Sybase IQ...
I am in a large organization.  I do not have the convenient means to find more about the specific version.  Can you just go with the most likely version?

SOLUTION
Avatar of Joe Woodhouse
Joe Woodhouse

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial