0

Here is my query:

UPDATE users SET active = -1 WHERE id = ? AND active IS NULL

It works on my current MySQL version. I mean it sets 1111111111 as active value. Noted that active is BIT(10) datatype.

But recently I've upgraded the MySQL version and it throws:

string(94) "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'active' at row 1"

Any idea how can I fix it?

Martin AJ
  • 6,261
  • 8
  • 53
  • 111

1 Answers1

0

If you want something with a bunch of bits, use BINARY(2) to get 16 bits. If you need a really long bit string, use BLOB or MEDIUMBLOB.

Rick James
  • 135,179
  • 13
  • 127
  • 222