Solved

create a trigger table

Posted on 2015-01-26
2
76 Views
Last Modified: 2015-01-28
Hi Experts
i have an old system created useing a classic asp, the system is an employees system that save are employee records and information, they required me to create a Audit trail report for every insert/update and delete in the records, i serached the net i found that i need to create a trigger table, but i didnt find any goo artical on how to do this in easy step by step,

do i have to create a stored procedur or function under the SQL

i alreadey created a table name AuditTrail_tbl with th following columns
Ricno incremental identity
Username
LogDateTime
Type: delete insert or update

please help
0
Comment
Question by:AZZA-KHAMEES
2 Comments
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 500 total points
Comment Utility
Hi Azza,
What possibly may help you is a DML trigger on the table - the following is a sample:
CREATE TRIGGER AuditTrailMyTable ON dbo.MyTable
AFTER INSERT
AS
INSERT 
AuditTrail_tbl
SELECT
*
FROM inserted -- system table which contains records just inserted

Open in new window

0
 

Author Comment

by:AZZA-KHAMEES
Comment Utility
I've requested that this question be deleted for the following reason:

i found the solution
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now