Error Code: 1406. Data Too long for column 'txtContability' at Row 1

Asked

Viewed 12,979 times

0

In Mysql..

I am wanting to do UPDATE in a text field, the same has about 300 characters and does not allow to do it, informed that it is too long. I’ve tried changing the field type up to "Longtext", "VARCHAR(1000)" and didn’t allow it. Is there a limitation in Mysql settings or something? What to do in this situation?

  • You can put the complete error message?

  • Error Code: 1406. Data Too long for column 'txtContability' at Row 1... .

1 answer

2

Changing the field to longtext should solve the problem, this error is triggered when the amount of characters is greater than the field’s storage, so the excess characters are truncated.

The limit of the varchar field is 255 (0 to 255).

Try changing to longtext again, remember to change the table name, CHARACTER SET and DEFAULT if necessary,

ALTER TABLE nomeDaTabela CHANGE txtContabilidade txtContabilidade LONGTEXT CHARACTER 
    SET latin1 COLLATE latin1_general_ci NULL DEFAULT NULL;

if you can’t, send the codes related to the problem, query Insert, query select and your table Structure, I’ll be here and help you solve it.

  • It didn’t work...the error that occurs is the same as "Error Code: 1406. Data Too long for column 'txtContability' at Row 1"...the field "txtContability" is like LONGTEXT with the collation "latin1_general_ci", accepting NULL...the query is update: "update requisicao set txtContability = 'mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'

  • I saw that it accepts up to 200 characters only...

  • It has to send the structure of this table so that I simulate here in my environment?

  • CREATE TABLE requisicao ( codigo int(11) NOT NULL AUTO_INCREMENT, txtContabilidade longtext, PRIMARY KEY (codigo) ) ENGINE=Innodb AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;

  • 2

    max_allowed_packet = 1048576000

  • 1

    Solved! After I made the changes to max_allowed_packet, it worked!

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.