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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:15:50+00:00 2026-05-11T15:15:50+00:00

I want a trigger to fire only when UPDATEs are user-initiated (not me running

  • 0

I want a trigger to fire only when UPDATEs are user-initiated (not me running updates from the MySQL command line).

What’s the ‘industry standard’ for achieving this? I have been trying unsuccessfully to detect a variable passed in with the query (i.e. @user_update=true), but without success. A colleague of mine suggested a way to do it would be to add a new column into the table containing the trigger: ‘fire_trigger’, for example. And fill this with ‘true’ when running the SQL from the code, and ensure that this is present in order for the trigger to fire.

Any help much appreciated!

  • 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. 2026-05-11T15:15:50+00:00Added an answer on May 11, 2026 at 3:15 pm

    Disable the trigger before doing command-line updates and re-enable it after.

    But you’re doing this wrong, conceptually.

    Why shouldn’t the trigger run when you use the command line? I Assume this is some sort of auditing trigger, that captures who updated a row. You at the command line are a ‘who’ too.

    Comment from OP:

    Yes – good point! 🙂 It is a ‘dd/mm/yyyy hh:mm – User A changed First name from ‘Jane’ to ‘Joan” type thing. I just don’t want it to fill the history table during the test phase when I’m potentially updating rows ‘manually’.

    Then either disable the trigger, or just delete the added history rows after. Even better, do your testing on a separate database, and just don’t worry about this at all.

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

Sidebar

Related Questions

I want a SQL trigger to fire when a table is updated. I have
Hi i want to call a stored procedure or fire a trigger when a
I want to trigger a special action in the save() method of a Django
I want to trigger on click of a button this: <asp:Button runat=server ID=submit Text=Submit
I want to trigger javascript alert using PHP. Is it possible I want to
If I want to trigger an error in my interpreter I call this function:
I came in to scenario that I want to trigger service on specific time.
I have a div, containing text and a few links. I want to trigger
I want to create a trigger on a SQL Server table. Table has 8
I want to use some kind of trigger to change a button in my

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.