Re: Trigger for audit log

From: Kirk Graves (krgitsoftware_at_yahoo.com)
Date: 03/04/04


Date: Thu, 4 Mar 2004 12:52:19 -0700

The only way data is going to change in the table is through an Insert,
Update, or Delete (assuming that security is set correctly on the table).
So you should be able to trap all changes to the table in the appropriate
trigger.

Be aware that there is one other way to change the data. Truncate. If a
user Truncates the table, all data is dropped, and no trigger is called, no
Transaction is generated, it is nasty. However, you should have the
database set up so that only your dbo can truncate, and more importantly,
noone is logging into the database as dbo except as specific maintainence
issues require.

Kirk

"E Sullivan" <ellie999nospam@nospamptd.net> wrote in message
news:%23WEONAiAEHA.1468@tk2msftngp13.phx.gbl...
> Hi,
>
> I'm thinking of using a trigger to write to a table whenever data is
changed
> in a table. Since you can get a trigger to work for the insert, update or
> delete statement, is that the only way, through VB code, to make a change
to
> the data in a table?
>
> Thanks,
>
> Ellie
>
>



Relevant Pages

  • Re: Triggers, truncate field, how to
    ... The lenfunction is the correct function to find the length of a character ... But I am wondering why you would want to truncate the column to only ... know where to find the wright syntax code for it. ... trigger to do logically. ...
    (microsoft.public.sqlserver.server)
  • Re: TRUNCATE and DELETE
    ... > truncate in sql. ... TRUNCATE TABLE removes the data ... See the topic "Pages and Extents" in Books online. ... > means that whenever we executes a DELETE statement a trigger si fireing ...
    (microsoft.public.sqlserver.programming)
  • Re: TRUNCATE and DELETE
    ... foreign key in a table then i cant use trancate on that table .. ... TRUNCATE TABLE removes the data ... > If you have a delete trigger then it will fire when you delete a record. ...
    (microsoft.public.sqlserver.programming)
  • Re: TRUNCATE and DELETE
    ... You cannot do TRUNCATE if the table is *referenced* by a FK. ... Tibor Karaszi, SQL Server MVP ... > "John Bell" wrote: ... >>> means that whenever we executes a DELETE statement a trigger si fireing ...
    (microsoft.public.sqlserver.programming)
  • Who may create a trigger on SYSOBJECTS table
    ... Is it possible to create a trigger on SYSOBJECT? ... I am logged on as dbo, and trying to create a trigger that executes when a ... Check if you are DBO: ...
    (microsoft.public.sqlserver.programming)

Loading