3 messages in com.mysql.lists.mysqlLOAD DATA INFILE and BIT columns
FromSent OnAttachments
Julie Kelner24 Feb 2006 20:27 
sheeri kritzer27 Feb 2006 12:50 
Julie Kelner27 Feb 2006 13:18 
Subject:LOAD DATA INFILE and BIT columns
From:Julie Kelner (bi@rubymuse.com)
Date:02/24/2006 08:27:00 PM
List:com.mysql.lists.mysql

Hi. I'm using MySQL 5.0.18, and I'm trying to use LOAD DATA INFILE into tables
that have BIT(8) columns. No matter what format I use, the result is not what I expect (see example below.) Anyone
know how to properly format the data for loading into a BIT column? Thanks!

$ cat /tmp/bit_test.txt 01010101 2 b'010' b\'010\' 0x2 000000000000000002

mysql> create table bit_test (b bit(8)); Query OK, 0 rows affected (0.01 sec)

mysql> load data infile '/tmp/bit_test.txt' into table bit_test; Query OK, 6 rows affected, 3 warnings (0.00 sec) Records: 6 Deleted: 0 Skipped: 0 Warnings: 3

mysql> select bin(b+0) from bit_test; +----------+ | bin(b+0) | +----------+ | 11111111 | | 110010 | | 11111111 | | 11111111 | | 11111111 | | 11111111 | +----------+ 6 rows in set (0.00 sec)

Thanks!