Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trigger for tracking changes in table
Message
 
 
À
21/06/2003 11:44:34
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00802591
Message ID:
00802593
Vues:
32
Hi João,

I don't understand what number of tables has to do with having separate triggers for each operation? If you concern with maitanability, you can create external application that can even generate those triggers for you.
There's another problem with your trigger. It assumes that trigger is fired for each record affected but in fact it fires once per SQL command. You will have as many records in trigger's tables as # of records affected by that command. You've to make adjustments for tha. Something like
INSERT INTO dbo.tbl_system_log 
	(c_tablename,c_accao,c_codigoalt,c_username, d_datetime)
    SELECT 'dbo.tbl_gc_CodZonas', 'INSERT', c_codigo, suser_sname(), getdate()
    	FROM Inserted
>Hi all,
>I have this trigger to track the changes in the table dbo.tbl_gc_CodZonas, but it creates two reg for update and insert, any chance to create only one for UPDATE and one for INSERT. I know if i have one for UPDATE one FOR INSERT and one for DELETE it works, but my database have about 150 tables, or is there any other way to do that?
>
<snip>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform