Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

create a trigger table

Posted on 2015-01-26
2
Medium Priority
?
95 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

688 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