473,793 Members | 2,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

triggers audit

I need audit triggers that change columns value in the same record
that fire trigger.
I need how to do..
Thanks..
Jul 20 '05
11 6635

Thanks,

I activate execution plan and
this window write nine updates
on rows when I update the same
table in trigger after update.

I don`t change recursive_trigg ers to false
because this change affect all triggers in
my database sql server.

Do you know another solution ???
Thank you very much.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #11
raul garcia zamarra (ra****@ozu.es) writes:
I activate execution plan and
this window write nine updates
on rows when I update the same
table in trigger after update.
I'm not really sure what you mean here, but it does not sound like anything
to worry about. Since you have not given a full repro for your case, it
is a little difficult to run an example myself, to see what you are
talking about. But at least, that is not a token of a recursive trigger.
I don`t change recursive_trigg ers to false
because this change affect all triggers in
my database sql server.


Just to clear things out: there are *two* triggers settings in SQL
Server.

One is *nested triggers*. This is a server-wide configuration option
that is *on* by default. This option says that if you in an trigger
perform an INSERT/DELETE/TABLE on *another* table, any triggers on
that table will fire. This setting does not control what happens
if you update the table to which the trigger belongs.

The other setting is RECURSIVE_TRIGG ERS, and this is a database-wide
setting, which is *off* by default. When this setting is active,
if you update the same table in a trigger, the trigger will fire
anew.

Do you really have RECURSIVE_TRIGG ERS on? And do you really need to?
Recursive triggers are quite and advanced concept, as you must have
a way to stop recursion. There is a simple way though, if you want a
particular trigger to be non-recursive:

if trigger_nestlev el(@@procid) > 1
return

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3476
by: Keith | last post by:
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:
3
3642
by: John Pan | last post by:
Hi I am looking to implement an audit/history table/tables but am looking at doing this without the use of triggers. The reason for doing this is that the application is highly transactional and speed in critical areas is important. I am worried that triggers would slow things down. I am more used to other database where by there is a utility to "dump"
1
6172
by: Gent | last post by:
am using FOR UPDATE triggers to audit a table that has 67 fields. My problem is that this slows down the system significantly. I have narrowed down the problem to the size (Lines of code) that need to be compiled after the trigger has been fired. There is about 67 IF Update(fieldName) inside the trigger and a not very complex select statement inside the if followed by an insert to the audit table. When I leave only a few IF-s in the...
2
3417
by: ecastillo | last post by:
i'm in a bit of a bind at work. if anyone could help, i'd greatly appreciate it. i have a web app connecting to a sql server using sql server authentication. let's say, for example, my login/password is dbUser/dbUser. the web app however, is using windows authentication. so if I am logged into the network as 'DOMAIN\Eric', when I access my web app, my web app knows that I am 'DOMAIN\Eric'. but to the sql server db, I am user...
3
6295
by: Zlatko Matiæ | last post by:
Hello. I tried to implement audit trail, by making an audit trail table with the following fileds: TableName,FieldName,OldValue,NewValue,UpdateDate,type,UserName. Triggers on each table were set to do the job and everything was fine except that in the audit trail you couldn't know which row exacltly was updated/inserted/deleted...Therefore I introduced 3 additional columnes (RowMark1, RowMark2, RowMark3) which should identify the...
1
1980
by: Jeff Magouirk | last post by:
Dear Group, I would like to create an audit table that is created with a trigger that reflects all the changes(insert, update and delete) that occur in table. Say I have a table with Subject_ID, visit_number, dob, weight, height, User_name, inputdate The audit table would have .
1
2368
by: Mark Flippin | last post by:
I'm evidently not understanding nested triggers and I'm looking for some help. I've an Invoice table (see below) that I want to enforce two actions via after triggers. The first trigger maintains a set of audit columns in the table indicating the date on which the row was inserted, the date of the last change, and the user who made the last change (see below)
5
6473
by: Michel Esber | last post by:
Audit trigger Hello, LUW DB2 V8 FP13 I am trying to create audit triggers in order to find out which user/application is deleting data from a table, as well as the statement the user entered.
0
936
by: chirnag | last post by:
I have and audit table to collection changes happening on an entity. This will be taken care by triggers. During a batch test, I found that out of 1000 inserts into the main table, I got only 997 entries into audit table. I suspected that there might be a problem in the way I am accessing inserted tuple( I am reading only one record from inserted tuple and inserting that record into audit table). So, I changed my trigger code to create a...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.