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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:27:01+00:00 2026-06-01T11:27:01+00:00

I have a table with about 10K rows, which I am trying to alter

  • 0

I have a table with about 10K rows, which I am trying to alter so that the field fielddelimiter is never null. I am attempting to do an alter statement, expecting any null values to be changed to the default value, but I get an error back from the sql statement.

alter table merchant_ftp_account modify column `fielddelimiter` char(1) NOT NULL DEFAULT 't';

17:08:48  [ALTER - 0 row(s), 0.000 secs]  [Error Code: 1265, SQL State: 01000]  Data truncated for column 'fielddelimiter' at row 3987
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec  [0 successful, 0 warnings, 1 errors]

As I understand it this means that the data exceeds the field size at this row, but (a) the data in the field is (null) at that row, and (b) I am able to update that row directly with the value ‘t’, and I don’t get a truncation error. If I update that row with a nonnull value and try to re-run the alter statement, it fails at the next row where fielddelimiter is null. [ETA: I get that MySQL could update in any direction, but I can actually track its progress as I change rows.]

There’s a warning in the MySQL docs:

Warning This conversion may result in alteration of data. For example, if you shorten a
string column, values may be truncated. To prevent the operation from succeeding if
conversions to the new data type would result in loss of data, enable strict SQL mode
before using ALTER TABLE (see Section 5.1.6, “Server SQL Modes”).

But the values that it’s supposedly truncating are nulls. Can anybody explain to me what is going on here? And how to resolve it?

[ETA: The existing fielddelimiter field definition is char(1) (allows nulls, no default value), so it should not have values > 1 char, and a select confirms that it does not. The distinct values in the field are NULL, ” (empty string), ‘p’, ‘t’, and ‘y’.]

  • 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-01T11:27:03+00:00Added an answer on June 1, 2026 at 11:27 am

    I have just encountered this error, and it seems the solution was to use the IGNORE statement:

    ALTER IGNORE TABLE `table` CHANGE COLUMN `col` `col` int(11) NOT NULL;
    

    Note that you may still have data truncation issues, so be sure this is the desired result. Using the IGNORE statement it will suppress the data truncated errors for NULL values in columns (and possibly other errors!!!)

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

Sidebar

Related Questions

I have to delete about 10K rows from a table that has more than
I have a table with about 5,000 rows which I build dynamically with jQyuery.
I have a table with about 100.000 rows that used to look more or
We have a table with about 770,000 rows, in which only a few hundred
We have about 10K rows in a table. We want to have a form
I have table which has about 50 rows. Each row has link, but I
I have a table of about 100M rows that I am going to copy
I have a table of about a million rows and I need to update
i have a table with about 200,000 records. i want to add a field
I have a table that has about 1/2 million records in it. Each month

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.