尝试插入表时错误代码1265数据被截断

时间:2014-06-20 03:22:58

标签: mysql

我在尝试插入数据库时​​遇到此错误:

error code 1265 data truncated on `bd_html`

这里的表格:

CREATE TABLE IF NOT EXISTS `frame_board_intra_board` (
  `bd_no` int(10) unsigned NOT NULL auto_increment,
  `bd_order` int(10) unsigned NOT NULL default '0',
  `bd_depth` int(10) unsigned NOT NULL default '0',
  `bd_root` int(10) unsigned NOT NULL default '0',
  `bd_parent` int(10) unsigned NOT NULL default '0',
  `ca_no` int(10) unsigned NOT NULL default '0',
  `bd_notice` enum('0','1') NOT NULL default '0',
  `userID` varchar(20) NOT NULL default '',
  `userName` varchar(20) NOT NULL default '',
  `userPass` varchar(41) NOT NULL default '',
  `userEmail` varchar(100) NOT NULL default '',
  `bd_secret` varchar(41) NOT NULL default '',
  `bd_title` varchar(255) NOT NULL default '',
  `bd_content` text NOT NULL,
  `bd_html` enum('0','1') NOT NULL default '0',
  `bd_noBr` enum('0','1') NOT NULL default '0',
  `bd_regDate` datetime default NULL,
  `bd_ip` varchar(40) NOT NULL default '',
  `bd_procedure` int(2) NOT NULL default '0',
  `bd_hit` int(10) unsigned NOT NULL default '0',
  `bd_vote` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`bd_no`),
  KEY `bd_order` (`bd_order`),
  KEY `userID` (`userID`),
  KEY `userName` (`userName`),
  KEY `bd_title` (`bd_title`),
  KEY `bd_regDate` (`bd_regDate`),
  KEY `bd_hit` (`bd_hit`),
  KEY `bd_vote` (`bd_vote`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

这是我试图插入的数据:

INSERT INTO `frame_board_intra_board` (`bd_no`, `bd_order`, `bd_depth`, `bd_root`, `bd_parent`, `ca_no`, `bd_notice`, `userID`, `userName`, `userPass`, `userEmail`, `bd_secret`, `bd_title`, `bd_content`, `bd_html`, `bd_noBr`, `bd_regDate`, `bd_ip`, `bd_procedure`, `bd_hit`, `bd_vote`) VALUES
(1, 4294967195, 0, 1, 0, 0, '0', 'test', '테스터', 'mdOh3LqBW8ckU', '', '202cb962ac59075b964b07152d234b70', '인트라넷 게시판 테스트입니다.', '<P>인트라넷 게시판입니다.</P>', '', '', '2010-10-04 14:18:19', '124.137.28.78', 0, 6, 0);

我在插入数据库时​​使用的是mysql workbench。

1 个答案:

答案 0 :(得分:2)

在某些数据库中,角色的大小会有所不同。您在varchar字段中插入“宽”字符是可疑的,但在MySQL中这是可以的。

相反,问题出在bd_html上。此列定义为采用'0''1'值。但是,您正在传递''。您应该使用NULL'0'