日期:2014-05-16  浏览次数:20898 次

MySql end_date timestamp(8) NOT NULL报错怎么解决?
最近经理让调研openi方案,在导入openi里自带的create-foodmart-mysql.sql时候报错了,错误如下,求指导。
Query:
CREATE TABLE employee (
  employee_id int(11) NOT NULL default '0',
  full_name varchar(30) NOT NULL default '',
  first_name varchar(30) NOT NULL default '',
  last_name varchar(30) NOT NULL default '',
  position_id int(11) default NULL,
  position_title varchar(30) default NULL,
  store_id int(11) NOT NULL default '0',
  department_id int(11) NOT NULL default '0',
  birth_date date NOT NULL default '0000-00-00',
  hire_date timestamp(14) NOT NULL,
  end_date timestamp(14) NOT NULL,
  salary decimal(10,4) NOT NULL default '0.0000',
  supervisor_id int(11) default NULL,
  education_level varchar(30) NOT NULL default '',
  marital_status varchar(30) NOT NULL default '',
  gender varchar(30) NOT NULL default '',
  management_role varchar(30) default NULL,
  UNIQUE KEY i_employee_id (employee_id),
  KEY i_employee_department_id (department_id),
  KEY i_employee_store_id (store_id),
  KEY i_employee_supervisor_id (supervisor_id)
) ENGINE=MyISAM

Error occured at:2012-08-14 11:05:09
Line no.:10557
Error Code: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(14) NOT NULL,
  end_date timestamp(14) NOT NULL,
  salary decimal(10,4) NOT NUL' at line 11

------解决方案--------------------
timestamp(14) 都改成datetime
------解决方案--------------------
CREATE TABLE employee (
 employee_id int(11) NOT NULL default '0',
 full_name varchar(30) NOT NULL default '',
 first_name varchar(30) NOT NULL default '',
 last_name varchar(30) NOT NULL default '',
 position_id int(11) default NULL,
 position_title varchar(30) default NULL,
 store_id int(11) NOT NULL default '0',
 department_id int(11) NOT NULL default '0',
 birth_date date NOT NULL default '0000-00-00',
 hire_date timestamp NOT NULL,
 end_date timestamp NOT NULL,
 salary decimal(10,4) NOT NULL default '0.0000',
 supervisor_id int(11) default NULL,
 education_level varchar(30) NOT NULL default '',
 marital_status varchar(30) NOT NULL default '',
 gender varchar(30) NOT NULL default '',
 management_role varchar(30) default NULL,
 UNIQUE KEY i_employee_id (employee_id),
 KEY i_employee_department_id (department_id),
 KEY i_employee_store_id (store_id),
 KEY i_employee_supervisor_id (supervisor_id)
) ENGINE=MyISAM