Re: Trigger question.
Posted in 1996
Richard Thomas wrote: > > Spetc wrote: > > > > Suppose you have a table with a date last modified column (datetime year > > to second.) > > > > This column would be stamped with the current date and time whenever a row > > is inserted or modified in the table. > > > > This would ideally be done via inserts and update triggers. > > > > Do anyone know how to use a trigger to intercept the insert or update and > > set this value prior to the insert / update operation? > > Hi, > > The problem here is that a triggered action cannot act on the > table that triggered it. AFAIK, you have two options: > > 1. Build the timestamp into the application so that it is processed > with the rest of the row. (PERFORM, 4GL, SQL insert/update statement) > > 2. Build a separate table: And #3 - Just set the default value of the timestamp column to current - that way you do not need a trigger on insert (just update). Am I missing something? -- Martin Andrews andrewm@ccfadm.eeg.ccf.org Section of Neurological Computing, Cleveland Clinic Foundation