Solved

create a trigger table

Posted on 2015-01-26
2
87 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
ID: 40570409
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
ID: 40576143
I've requested that this question be deleted for the following reason:

i found the solution
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Acces SQL Insert Problem 6 31
IIS components 2 15
Isolation level setting TSQL View 10 27
SQL - Curser to do an insert based on a select 2 10
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

856 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