Solved

create a trigger table

Posted on 2015-01-26
2
92 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

738 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