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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:25:36+00:00 2026-05-22T19:25:36+00:00

I have seen this several times. I have one server that allows me to

  • 0

I have seen this several times. I have one server that allows me to insert some of the values, without specifying the others like so: INSERT INTO table SET value_a='a', value_b='b'; (value_c is a field that does not have a default value set, but it works fine here). When the script is moved to a new server some INSERT queries break because it requires the query to specify all non-default values, giving me the following error for the first occurrence of not specifying a non-default value:

#1364 - Field 'value_c' doesn't have a default value

Setting default values for the table might break functionality in other areas, otherwise I would just do that. I would love to know what exactly is going on here.

  • 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-22T19:25:37+00:00Added an answer on May 22, 2026 at 7:25 pm

    One of your servers is running in strict mode by default and the other not.
    If a server runs in strict mode (or you set it in your connection) and you try to insert a NULL value into a column defined as NOT NULL you will get #1364 error. Without strict mode your NULL value will be replaced with empty string or 0.

    Example:

    CREATE TABLE `test_tbl` (
     `id` int(11) NOT NULL,
     `someint` int(11) NOT NULL,
     `sometext` varchar(255) NOT NULL,
     `somedate` datetime NOT NULL,
     PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    
    SET sql_mode = '';
    INSERT INTO test_tbl(id) VALUES(1);
    SELECT * FROM test_tbl;
    +----+---------+----------+---------------------+
    | id | someint | sometext | somedate            |
    +----+---------+----------+---------------------+
    |  1 |       0 |          | 0000-00-00 00:00:00 |
    +----+---------+----------+---------------------+
    SET sql_mode = 'STRICT_ALL_TABLES';
    INSERT INTO test_tbl(id) VALUES(2);
    #1364 - Field 'someint' doesn't have a default value 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is this?: document.getElementById(+id+) I have seen this used several times in code on
I have seen this question in SO several times. Most of cases user called
I have seen several posts similar to this but none with a strait forward
We have several areas where code like this can be seen public Map extractData(ResultSet
I have seen this effect where when mouse is over an image, that image
I'm just curious about Domain-Specific Languages. I have seen them several times in articles,
This should be a simple task, but I have seen several attempts on how
I have seen several posts online complaining that Firefox maintains the history url hash
I have seen this question about deploying to WebSphere using the WAS ant tasks.
I have seen this for a long time, and finally decided to put the

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.