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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:15:44+00:00 2026-05-29T10:15:44+00:00

I need some help writing a MySQL trigger. what i want to do is

  • 0

I need some help writing a MySQL trigger.
what i want to do is to calculated hashe value of autoincrement ID and store it in separate column:

create trigger hashing after insert on categories 
for each row begin
   set new.hashed = md5(CONCAT("key",`categories `.`id`));
end;

but i get error:

[Err] 1362 - Updating of NEW row is not allowed in after trigger

Can someone help me achieve what i need? Is this possible at all using triggers?

Thanks

  • 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-05-29T10:15:45+00:00Added an answer on May 29, 2026 at 10:15 am

    What you are trying to do is not supported.

    You can only set the value of the “hashed” column in a BEFORE INSERT trigger, not an AFTER INSERT trigger.

    However, you can’t access the value of the auto-increment “id” column in a BEFORE INSERT trigger because that value is not known yet.

    If you are determined to do this via a trigger, one option is to create a separate table to store the hashed value (along with a foreign key to reference the “categories” table), and insert into that table using an AFTER INSERT trigger on your “categories” table.

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

Sidebar

Related Questions

I need some help writing an http client. The trouble comes when I try
I'm new to web programming, so I need some help. I am writing a
Need some help about with Memcache. I have created a class and want to
I need some help writing a SQL statement. I have two tables in a
I need some help on writing the appropriate JavaScript and on where to place
I need some help on the xslt that I'm writing. Below is my source
I need some help with a program I'm writing for my Programming II class
I'm writing an application and need some help with consistently storing and loading preferences
hey im writing a c# flv2mp3 converter and i could need some help. flv
I'm writing a C++ program and I need some help understanding an error. By

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.