6

I've got a table with

`terms_of_payment` enum('0','1') NOT NULL DEFAULT '0' COMMENT ''

I run

ALTER TABLE `customer` 
CHANGE `terms_of_payment` `terms_of_payment` TINYINT( 1 ) 
     NOT NULL DEFAULT 0 COMMENT '';

and I found all my customers (with '0' value) set to 1 when I'm waiting 0

Could you explain me, what's the trouble, please ?

Bye

0

1 Answer 1

10

Converting the ENUM to TINYINT might give unexpected results, as MySQL will actually already store your ENUM in the form of integers. To get the result you want, you should actually start by converting your column to a CHAR(1) and then go to TINYINT(1).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.