我正在使用制表符分隔文件将数据插入 MySql 数据库
在位字段中,我得到 0 和 1 作为值,但是当我使用下面的命令将数据插入数据库时,它会将 0 转换为 1。
load data local infile 'c:/membership.txt' into table membership;
结果,位列在每一行中的值为 1。
表的结构是
Create table Membership
(
MemberShipId int not null AUTO_INCREMENT,
StartDate datetime not null,
EndDate datetime not null,
AgeGroup tinyint,
Newsletter bit,
Donation decimal(7,2),
FavouriteShow varchar(50),
Comments varchar(200),
MemberId int not null,
PRIMARY KEY (MemberShipId),
CONSTRAINT fk_Member FOREIGN KEY (MemberId) REFERENCES Member (MemberId)
);
样本输入是
1 2012-01-01 2012-01-01 0 0 \N \N 1
2 2012-01-01 2012-01-01 1 0 \N \N 2
3 2012-01-01 2012-01-01 1 0 \N \N 3
4 2012-01-01 2012-01-01 1 0 \N \N 4
5 2012-01-01 2012-01-01 0 0 \N \N 5
6 2012-01-01 2012-01-01 0 0 \N \N 6