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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Problem with trigger

Author  Topic 

nareshbhatt2009
Starting Member

3 Posts

Posted - 2011-05-05 : 08:52:51
Hi guys,

I have a problem regarding a trigger. I take an example :

Suppose i have a table name 'Employee' which have 4 coulmns named as emp_id(primary key),emp_name,emp_designation,emp_salary and have 100 records in that table. And i want to create a trigger by which we can record any updation on employee table by user in other table having same specification. so anybody helps me...

I will wait for reply....

naresh

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-05-05 : 09:00:27
maybe nigel can help: http://www.simple-talk.com/sql/database-administration/pop-rivetts-sql-server-faq-no.5-pop-on-the-audit-trail/


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-05 : 09:00:35
Create after update trigger
http://msdn.microsoft.com/en-us/library/aa258254(v=sql.80).aspx
or if you are useing SQL Server 2008
use Change Data Capture feature
http://www.simple-talk.com/sql/learn-sql-server/introduction-to-change-data-capture-%28cdc%29-in-sql-server-2008/

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

nareshbhatt2009
Starting Member

3 Posts

Posted - 2011-05-05 : 09:04:35
thanks guys and i m using sql server 2005 and i want to record each and every updation in another table...

naresh
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-05 : 09:07:05
Then you have only option of After update trigger
http://stackoverflow.com/questions/4574010/how-to-create-trigger-to-keep-track-of-last-changed-data

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page
   

- Advertisement -