Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger for tracking changes in table
Message
 
 
To
21/06/2003 11:44:34
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00802591
Message ID:
00802593
Views:
29
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform