我有一个名为incident_log的表,其结构是这个
CREATE TABLE `incident_log` (
`il_id` int NOT NULL auto_increment,
`il_i_id` int default NULL,
`il_time_occured` datetime NOT NULL,
`il_status` varChar(255) NOT NULL default 'OPEN',
`il_prevstate` varChar(255),
`il_trigger` varchar(255),
`il_current_state` int NOT NULL default 0,
`il_prev_state` int NOT NULL default 0,
`il_current_trigger` int NOT NULL default 0,
`il_prev_trigger` int NOT NULL default 0,
`il_pol_as_status` mediumblob,
`il_obj_id` int,
`il_occuredCount` int default 0,
`il_reportedOccuredCount` int default 0,
`il_reportedCount` int default 0,
`il_cascadeReportedTime` bigint default 0,
`il_obj1` text,
`il_obj2` text,
`il_obj3` text,
`il_itype` enum('CRITICAL','EVENT') NOT NULL default 'CRITICAL',
`il_usrNotifyStatus` enum('NEW','NOTIFIED','NOT_NOTIFIED') NOT NULL default 'NEW',
`il_rootcause_il_id` int NOT NULL DEFAULT 0,
`il_rootcause_info` text DEFAULT NULL,
`il_rootcause_i_objclass` enum('DATASET','COMPONENT','SERVICE','SERVER','BCS') default NULL,
`il_rootcause_i_obj_id` int(11) default 0,
`il_acset_id` int default NULL,
`il_intRes1` int,
`il_intRes2` int,
`il_intRes3` int,
`il_intRes4` int,
`il_varcharRes1` varchar(64),
`il_varcharRes2` varchar(255) );
但是在插入以下数据时会给我一个错误
ERROR 1136 (21S01): Column count doesn't match value count at row 1
INSERT INTO incident_log (il_i_id, il_time_occured, il_cascadeReportedTime,
il_occuredCount,il_obj_id, il_obj1, il_obj2, il_obj3,
il_status, il_rootcause_il_id, il_rootcause_info,
il_rootcause_i_objclass, il_rootcause_i_obj_id,
il_acset_id)
VALUES (1,'',0,0,12,'','','','OPEN',0,NULL,NULL,0,NULL);
请帮我解决这个问题..
答案 0 :(得分:1)
我在您的create table语法
中找到了一些更正il_time_occured
。通过错误错误字段插入''
(空值)时。插入语句中没有错误
此查询正常。
INSERT INTO incident_log (il_i_id, il_time_occured, il_cascadeReportedTime, il_occuredCount,il_obj_id, il_obj1, il_obj2, il_obj3, il_status, il_rootcause_il_id, il_rootcause_info, il_rootcause_i_objclass, il_rootcause_i_obj_id, il_acset_id) VALUES (1,'2012-12-27 16:03:32',0,0,12,'','','','OPEN',0,NULL,NULL,0,NULL)
参考屏幕简介: