Click here to Skip to main content
16,016,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All

I want to load data from a Impot table(say. Student_Import) to actual table (say . Student).

The process should like happen this "Whenever a row is inserted or updated from Import to Actual , the system should record them in a Audit table (say Audit(table_name,action,Comments,Date) and the inserted values should come under Comment Column of Audit table like (Name=Ajay ,Section = B Course = SQL)."

A Record is updated when a match is found as per the StudentID column in both tables (Import as well as Actual table) else it should be inserted ."

both insert and update should record the changes into table Audit

For Update ,the Comment Column of Audit table should store the after and before values for all columns that are being changed .

Thanks in advance.
Posted

1 solution

Then you need to write two triggers on actual table(Say Student)
1) Update trigger
2) Insert trigger

We are generally calling such type of trigger as "Audit Trigger"

Refer below link for more details
http://stackoverflow.com/questions/1962398/creating-audit-triggers-in-sql-server[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900