Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:37:03+00:00 2026-06-08T17:37:03+00:00

Ive got a task here to log changes in the database. So Ive just

  • 0

Ive got a task here to log changes in the database.

So Ive just read about Triggers and that made me interested to try that out.

I got this table in the database were the customer information is described,

(id fornamn, efternam.. etc is the column names and the information underneath is the values)

This table is called “kunder”

id  fornamn     efternamn   adress  ort     postnummer  foretag     telefon         email           personNmr   husNmr  organisationsNmr    produkt     uppringd    prioritet   raderad
15  Peter       Tressing    adress  ort     41676       foretag     071234565       email@email.se  123456      4       55658794            Nocria      1           0           0

I called this table kunder_log

id  fornamn     efternamn   adress  ort     postnummer  foretag     telefon         email           personNmr   husNmr  organisationsNmr    produkt     uppringd    prioritet   raderad     timestamp   type

(the only diffirance is index instead of primary key on the ID and I added the timestamp and type)

(Type the type of the query (insert, delete or update))

Now i want to trigger changes for each row in the table when i do an Update/Insert/Delete query.

But I only want to insert the changes made and not every column in the old table.

Is this possible or do you recomend another approache?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:37:04+00:00Added an answer on June 8, 2026 at 5:37 pm

    Basically there are two approaches to log all the changes done on main table:

    1. trigger is good option if you want to log all the changes made to tables globally.

    2. write insert into change log tables after every insert, update, delete statement in all stored procedures.

    I generally prefer second approach as it is much faster as compared to triggers.

    Sample table structure:

    kunder
        all_columns
    
    kunder_log
        change_log_id INT unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
        all_columns
        change_type ENUM('INSERT','UPDATE','DELETE'),
        change_time TIMESTAMP NOT NULL DEFAULT 0,
        change_description VARCHAR(1024)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a common task that I do with some Activities - downloading data
I've got an Ant task that when launched will update the version number in
I've got a build.gradle task that works like a champ on my dev box
So here's the scenario. I've got a script that runs some tests. I need
I've hit a minor brick wall here in Visio. I've got a project that
So I've got somewhat of a cool task and I'm just thinking it over.
I've got an first chance exception in ppltasks.h's _ContextCallback that I just don't understand.
I've got task to do and I even dont know how to start. I
So, I've got task from my boss to install opendocman on our newly installed
I've got the unpleasurable task of working on a Classic ASP site (VBSCRIPT) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.