31

statue typethe situationI am trying to insert or edit the bit value to "0" or "1", but either returns me a blank.

Could someone tells me how to insert the value in it?

Also, Is that possible to not use bit type but Boolean? I see there's a Boolean type in the list of types

Thanks

Hi, I have uploaded the picture, the cell in the table is blank, but I have tried several times, add, update, all take effect, but cell keeps blank...

tRuEsAtM
  • 3,517
  • 6
  • 43
  • 83
James Chen
  • 833
  • 3
  • 10
  • 23

3 Answers3

31

Generally speaking, for boolean or bit data types, you would use 0 or 1 like so:

UPDATE tbl SET bitCol = 1 WHERE bitCol = 0

See also:

Community
  • 1
  • 1
Kermit
  • 33,827
  • 13
  • 85
  • 121
5

If you're using SQL Server, you can set the value of bit fields with 0 and 1

or

'true' and 'false' (yes, using strings)

...your_bit_field='false'... => equivalent to 0
Alcides Queiroz
  • 9,456
  • 3
  • 28
  • 43
5

Your issue is in PHPMyAdmin itself. Some versions do not display the value of bit columns, even though you did set it correctly.

Fer
  • 4,116
  • 16
  • 59
  • 102