Christian Burgos
Christian Burgos

Reputation: 1591

error code 1265 data truncated when trying to insert into table

i am having this error when i am trying to insert into my database:

error code 1265 data truncated on `bd_html`

here the table:

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;

and this is the data i am trying to insert:

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);

I am using mysql workbench when inserting to the database.

Upvotes: 0

Views: 1562

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269873

In some databases, the size of the character makes a difference. It is suspicious that you are inserting "wide" characters in to varchar fields, but this is ok in MySQL.

Instead, the problem is on bd_html. This column is defined to take '0' and '1' values. However, you are passing in ''. You should use either NULL or '0'.

Upvotes: 1

Related Questions