James Chen
James Chen

Reputation: 873

What value could I insert into a bit type column?

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...

Upvotes: 32

Views: 145031

Answers (3)

Fer
Fer

Reputation: 4196

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

Upvotes: 5

Alcides Queiroz
Alcides Queiroz

Reputation: 9576

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

Upvotes: 5

Kermit
Kermit

Reputation: 34054

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:

Upvotes: 32

Related Questions