Re: SQL Triggers for Auditing
From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 06/24/04
- Next message: Keith: "Re: SQL Triggers for Auditing"
- Previous message: ou812_at_ou812.com: "Re: Cookies in global.asa"
- In reply to: Keith: "SQL Triggers for Auditing"
- Next in thread: Keith: "Re: SQL Triggers for Auditing"
- Reply: Keith: "Re: SQL Triggers for Auditing"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Jun 2004 16:53:28 -0400
Would copying the first 8000 characters be enough? Do you really want to
store a copy of the entire row?
I suppose if you had a replica table, and the object table had a primary
key, you could do something like this in an instead of trigger:
INSERT tableCopy SELECT col1, col2, col3 FROM objectTable WHERE pk IN
(SELECT pk FROM inserted)
But man, that performance would not be good. And, you would have to handle
the normal operation as well (since the instead of trigger stops it from
happening).
-- http://www.aspfaq.com/ (Reverse address to reply.) "Keith" <@.> wrote in message news:O3LDJaiWEHA.2288@TK2MSFTNGP10.phx.gbl... > Not sure if anyone in here knows the answer to this, but I asked in a SQL > group and haven't had a suitable answer and since the front end app is ASP I > though I'd give here a try. > > I am trying to create a simple trigger in my SQL DB so that when a record is > updated or deleted a copy of the original record is placed in an audit > table. > > However, I keep getting the following error: > > Server: Msg 311, Level 16, State 1, Procedure SYS_Individual_AUDIT_Trigger, > Line 9 > Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' > tables. > > Now apparently this is because the TEXT column I have cannot be 'logged' or > so someone told me. > > Is there any way of using a trigger (an idiot proof way) so that I can copy > a record to an audit table when it is updated/deleted if the record contains > one or more TEXT columns? > > If all else fails I will write it into my app but I am trying to avoid that > if possible. > > Thanks > >
- Next message: Keith: "Re: SQL Triggers for Auditing"
- Previous message: ou812_at_ou812.com: "Re: Cookies in global.asa"
- In reply to: Keith: "SQL Triggers for Auditing"
- Next in thread: Keith: "Re: SQL Triggers for Auditing"
- Reply: Keith: "Re: SQL Triggers for Auditing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|