Enum date trucate

Asked

Viewed 26 times

0

I have the following query:

INSERT INTO celulas ( diaReunioes ) VALUES ( 'Terça' )

You’re making the following mistake:

Data Truncate for column 'diaReunioes' at row 1

This field in the table is:

  `diaReunioes` enum('Segunda',' Terça',' Quarta',' Quinta',' Sexta',' Sábado',' Domingo') NOT NULL DEFAULT 'Segunda',

Where is the error?

2 answers

1


For the row in the column definition:

  `diaReunioes` enum('Segunda',' Terça',' Quarta',' Quinta',' Sexta',' Sábado',' Domingo') NOT NULL DEFAULT 'Segunda',

I see that there are spaces in the definitions of names from the ' Tuesday' value, I believe the error is related to that definition. As the Enum values in mysql are stored as a byte, when informing 'Tuesday' without the space contained in the definition, sgbd understands that it is not the same value.

I suggest we run a test trying to insert ' Tuesday', just to confirm the hypothesis. If so, I suggest checking the definition of the column and changing it.

  • that’s right, thank you!

-1

This error is usually triggered when the character size of the data is greater than the defined field size. Checks the field size diasReunioes if it is less than 5 (in this case, 'Tuesday', which is 5 characters long)

Browser other questions tagged

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