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

  • Home
  • SEARCH
  • 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 8608481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:37:20+00:00 2026-06-12T03:37:20+00:00

I have field in MySQL table which i set it to default value as

  • 0

I have field in MySQL table which i set it to default value as timestamp,when I update it first time it get update to current timestamp and when I update it second time then also it get update to current timestamp bt when I update the same third time with same value in column timestamp field not get update to current timestamp.

My table structure is:

+-----------+-----------+------+-----+-------------------+-----------------------------+
| Field     | Type      | Null | Key | Default           | Extra                       |
+-----------+-----------+------+-----+-------------------+-----------------------------+
| EID       | int(11)   | NO   | PRI | 0                 |                             |
| MOD_EID   | int(11)   | YES  |     | NULL              |                             |
| EXIT_TIME | timestamp | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-----------+-----------+------+-----+-------------------+-----------------------------+

when I update first time I am inserting required value in EID and 0 in MOD_EID. When I update second time I am updating MOD_EID with required value. In both cases I able to get current_timestamp in EXIT_TIME.
But when I update MOD_EID field again with the same value after minute or one day , EXIT_TIME field not getting update to current_timestamp?
what’s wrong

The code for update is

String vexit=request.getParameter("string");

StringTokenizer tok=new StringTokenizer(vexit,"");

String sql,query,query2;
int count2=0;


    while(tok.hasMoreTokens())
    {
            String ide=tok.nextToken();
sql="SELECT count(EID) FROM tm_exit where EID='"+ide+"' ";
            ResultSet rs=st.executeQuery(sql);
            while(rs.next())
            {
            count2=rs.getInt(1);
}
        if(count2 >0)
            {
query="UPDATE tm_exit set MOD_EID='"+ide+"' WHERE EID='"+ide+"'";
int flag=st.executeUpdate(query);
}
        else
            {
query2="INSERT INTO tm_exit (EID,MOD_EID)values('"+ide+"',0)";
int flag2=st.executeUpdate(query2);
}
    }
  • 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-12T03:37:21+00:00Added an answer on June 12, 2026 at 3:37 am

    A TIMESTAMP column is only updated automatically if the value of some other column changes. If you set MOD_EID to the same value as it already had, the TIMESTAMP won’t be updated. I don’t know why it used to work for you, here’s what the documentation says:

    If the column is auto-updated, it is automatically updated to the
    current timestamp when the value of any other column in the row is
    changed from its current value. The column remains unchanged if all
    other columns are set to their current values. To prevent the column
    from updating when other columns change, explicitly set it to its
    current value. To update the column even when other columns do not
    change, explicitly set it to the value it should have (for example,
    set it to CURRENT_TIMESTAMP).

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

Sidebar

Related Questions

I have a mysql table field set as time type which stores data in
Hi I have a field in mySql table called jobnumber which auto increments with
I have a MySQL table which has a product_id field (big integer) 1102330008 1102330025
I have a table in MySQL 4.0 which currently has a year field as
I have a MySQL table where there is a 'date_added' (date) field, 'time_added' (time)
Let's say I have a very large MySQL table with a timestamp field. So
I have a table with a field which contains strings in my MySQL database.
I've a field of type char(1) in my MySQL table which basically can have
I have a MySQL table which hen created automatically puts a ISO 8601 timestamp
I have a MySQL table that has a field of comma separated values. How

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.