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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:27:42+00:00 2026-05-14T06:27:42+00:00

I have a table in MySQL 4.0 which currently has a year field as

  • 0

I have a table in MySQL 4.0 which currently has a year field as a smallint(6) type. What will happen if I convert it directly to a Year type with a query like the following:

ALTER TABLE t MODIFY y YEAR(4) NOT NULL DEFAULT CURRENT_TIMESTAMP;

When the current members of column y have values like 2010? I assume that because the year type is technically values from 1-255, values above that will be truncated or broken.

So if MySQL isn’t smart enough to realize that 2010(int) = 110(year), what would be the simplest query or queries to convert the values?

Thanks for your help!

  • 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-14T06:27:42+00:00Added an answer on May 14, 2026 at 6:27 am

    From MySQL Docs: 10.3.3 The year type

    For four-digit format, MySQL displays YEAR values in YYYY format, with a range of 1901 to 2155, or 0000. For two-digit format, MySQL displays only the last two (least significant) digits; for example, 70 (1970 or 2070) or 69 (2069).

    For years out of that range:

    Illegal YEAR values are converted to 0000.


    A quick test

    alter table foo add b year(4) not null default current_timestamp;
    update foo set b=a;
    
    a       b
    1900    0000
    1901    1901
    1950    1950
    2000    2000
    2002    2002
    2121    2121
    2155    2155
    2156    0000
    
    • 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
if i have a table which has columns with fixed lenght, Will mySQL count
I have a huge MySQL table which has its rows encoded in UTF-8 twice.
I have this mysql table called comments which looks like this: commentID parentID type
Hi I have a field in mySql table called jobnumber which auto increments with
I have MySQL table with the following structure: +---------+--------------+------+-----+---------+----------------+ | Field | Type |
I currently have a table which has these columns: id (INT) parent_id (INT) col0
If I have a table in MySQL which represents a base class, and I
I have a MySql table called reviews which stores a lot of product reviews,
I have a classified_id variable which matches one document in a MySql table. I

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.