我试图通过 mysql 表中的时间戳进行分区。但它返回一个错误。如果我尝试NOW()
也返回错误。如何解决此错误并使用时间戳数据类型进行分区?
CREATE TABLE tblemployeepunch (
fld_id int(11) NOT NULL AUTO_INCREMENT,
fld_date Varchar(15) DEFAULT NULL,
fld_rawpunchdate varchar(25) DEFAULT NULL,
fld_rawpunchtime varchar(25) DEFAULT NULL,
fld_cardno varchar(50) DEFAULT NULL,
fld_reasoncard varchar(20) DEFAULT NULL,
fld_mode varchar(20) DEFAULT NULL,
fld_punchdatetime varchar(50) DEFAULT NULL,
fld_crtdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY fld_id (fld_id,fld_crtdate),
KEY in_timesheet (fld_cardno,fld_punchdatetime,fld_mode,fld_rawpunchtime),
KEY in_emppunch (fld_cardno,fld_rawpunchdate,fld_punchdatetime)
)
PARTITION BY RANGE (fld_crtdate)
(PARTITION p_Sep12 VALUES LESS THAN (TO_TIMESTAMP('2012-10-01 00:00:00')),
PARTITION p_Oct12 VALUES LESS THAN (TO_TIMESTAMP('2012-11-01 00:00:00')),
PARTITION p_Nov12 VALUES LESS THAN (TO_TIMESTAMP('2012-12-01 00:00:00')),
PARTITION p_Max VALUES LESS THAN MAXVALUE );