[comp.databases] Audit trails -- any ideas?

gerardt@backnine.Corp.Sun.COM (Gerard Tynen) (04/04/91)

I would like to implement an audit trail mechanism in a Sybase
database I am designing.  It calls for tracking, on a user
level, who did what to what when.  I want to turn it off and
on, on a table by table basis.  I want to keep all the audits
in one table if I can.  So for example, we could have a table
like so:

	Audit_Trail  -- 

	table_id    user_id    operation  timestamp        what_happened
	--------    -------    ---------  ---------        ---------------
	 EMP         BIFF        CREATE    10am          added new emp# 2345 
	 DEPT        BIFF        UPDATE    11am          changed dept ABC to DEF
	 EMP         MUFFY       DELETE    1pm           removed emp# 1234 


What I am at a loss to figure out is how do I keep track of
"what_happened".  It's really different for each table. I don't
know. Maybe some kind of cryptic code or something.  Anyway,
has anyone out there ever tried this kind of thing?

GT