Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Triggers for insert,update,delete in SQL server
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 12/09/2013 :  12:17:22  Show Profile  Reply with Quote
I have created audit table

(column_name varchar(50),
old_value varchar(100),
new_value varchar(100),
Table_name varchar(100),
Username varchar(100),
action varchar(100),
Audit_Timestamp datetime

and I have table named testing
create table testing
(number int, name varchar(10))

I want trigger for insert,delete,update for table testing and the entries should be added to Test_Audit..I want the old values,new values,column name to be displayed in Audit table..

My trigger only works with 1 column table.If i run for 2 column table,the latest modified column is updated in oldvalue and new value..but actually 2 values should get updated in oldvalue and new value for 2 columns table

could anyone please help me with the queries??Your help is appreciated

Edited by - mkfrns on 12/09/2013 12:31:42

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 12/09/2013 :  12:32:36  Show Profile  Reply with Quote
Here are some links of how to set up audit triggers:

Here is a link to how to setup Auditing in the DB itself:
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000