johanvs
johanvs

Reputation: 4383

Set value of boolean (type = bit(1)) in MySQL Workbench

How can I edit the value of a boolean (type = bit(1)) in MySQL Workbench's result grid of a table?

If I set it to 1 or 0 I get the error :

ERROR 1406: 1406: Data too long for column 'enabled' at row 1

Upvotes: 24

Views: 19370

Answers (3)

Jack Miller
Jack Miller

Reputation: 7657

To avoid this well-known bug, you can also write 01 for true/1 and 00 for false/0.

E.g.

enter image description here

results in

enter image description here

which is valid MySql syntax.

Upvotes: 8

Bahadir Tasdemir
Bahadir Tasdemir

Reputation: 10793

You can also use true false keywords for value where true = 1 and false = 0.

MySQL Workbench Version: 6.3.4.0

UPDATE

Mysql Server Version: 5.6.27-log

enter image description here

Upvotes: 4

johanvs
johanvs

Reputation: 4383

Write b'1' for true, and b'0' for false.

Upvotes: 59

Related Questions