Solved

create a trigger table

Posted on 2015-01-26
2
91 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
push and Pull replication 31 46
SQL Server Trigger 8 34
SQL to JSON 14 31
SQL syntax question 6 38
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

740 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