How to View Bit Values in MySQL Query Browser

I stumbled across this useful tidbit the other day in the MySQL Forums. I’ve always been frustrated that bit data type values fail to appear in MySQL Query Browser. Instead, it simply displays a ‘b’ regardless of the actual value.

I looked through all of the options but couldn’t find a setting related to the issue. The solution (workaround) turned out to be very easy. Just add 0 to the column in the SELECT list and the values will appear.

For example:

SELECT myBooleanColumn + 0 as myBooleanColumn
FROM myTable

Either a 1 or a 0 will now appear as the value in the results.

mySQL, sql

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

2 Responses to “How to View Bit Values in MySQL Query Browser”

Leave Comment

(required)

(required)