I have a bit column like this:
// mytable
+---------+------------+
| id | numb |
+---------+------------+
| int(11) | bit(10) |
+---------+------------+
| 1 | NULL |
| 2 | NULL |
+---------+------------+
Not this is expected result:
// mytable
+---------+------------+
| id | numb |
+---------+------------+
| int(11) | bit(10) |
+---------+------------+
| 1 | 1111111111 |
| 2 | 1111111111 |
+---------+------------+
You know, I can do that like this:
UPDATE mytable SET numb = b'1111111111';
But maybe I will change the length of numb
column in future and then query above fails. How can I set 1
for all bits without knowing the length of bit-column?
EDIT: Actually I'm trying to do something like this:
UPDATE mytable SET numb = b'0';
/* output
+---------+------------+
| id | numb |
+---------+------------+
| int(11) | bit(10) |
+---------+------------+
| 1 | 0000000000 |
| 2 | 0000000000 |
+---------+------------+
*/
As you see, I set 0
for all bits without knowing the length of column. Well how can I do that just set 1
instead of 0
?