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 8007343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:47:36+00:00 2026-06-04T17:47:36+00:00

I supposed to make an sql trigger for update that will only activate when

  • 0

I supposed to make an sql trigger for update that will only activate when the affected rows are greater than 0. Yet, Even though the affected row is 0 (or the new record is identical to the old record) it still fires the trigger. I want to check the number of affected rows, before i execute the insert query below. Thanks in advance! Sorry for my grammar!

DELIMITER $$

DROP TRIGGER /*!50032 IF EXISTS */ `dbase`.`table_update_trigger`$$

CREATE
    /*!50017 DEFINER = 'root'@'localhost' */
    TRIGGER `table_update_trigger` AFTER UPDATE ON `table` 
    FOR EACH ROW BEGIN

IF (@@ROWCOUNT > 0) THEN
INSERT INTO 
    table_audit_trail
    (column1,
    column2,
    column3,
    column4,
    column5,
    column100) 
VALUES
    (old.column1,
    old.column2,
    old.column3,
    old.column4,
    old.column5,
    old.column100);
END IF;
END;
  • 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-04T17:47:38+00:00Added an answer on June 4, 2026 at 5:47 pm

    There is no @@ROWCOUNT in MySQL.
    You can read this post to find ount how to replace it.

    But you dont need that. Your trigger is for each row so it will fire for every updated row. (But that doesnt mean that your rows have changed. Just that they were updated by some statement.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems to me that introducing an ORM tool is supposed to make your
I supposed to make this type of charts, is it posssible to make through
So I am supposed to make 3 classes and am given a 4th class
The following code is supposed to make the right 60% of the display red.
I'm working on a small homework assignment and I'm supposed to make a food
Suppose I have an element called #container-main . How do I make that display:none
Suppose this is my URL route: (r'^test/?$','hello.life.views.test'), How do I make it so that
I want to write a few unit tests that do not make any changes
To make this easier to understand, I will present the exact same problem as
When showing my main window, I make a list of objects from linq-to-sql: using

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.