Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

unable to insert record into a table

Hi Experts,

 CREATE TABLE BATCH_JOB_PARAMS  (
      JOB_INSTANCE_ID BIGINT NOT NULL ,
      TYPE_CD VARCHAR(6) NOT NULL ,
      KEY_NAME VARCHAR(100) NOT NULL ,
      STRING_VAL VARCHAR(250) ,
      DATE_VAL TIMESTAMP DEFAULT 0,
      LONG_VAL BIGINT ,
      DOUBLE_VAL DOUBLE PRECISION ,
      constraint JOB_INST_PARAMS_FK foreign key (JOB_INSTANCE_ID)
      references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
) ;

This is the table i have created
When i am trying to add data to this table i am getting the below error
Data truncation: Incorrect datetime value: '1970-01-01 05:30:00' for column 'DATE_VAL' at row 1;


Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Guy Hengel [angelIII / a3]
in mssql, indeed the timestamp is not a date/time value:
https://msdn.microsoft.com/en-us/library/ms182776(v=SQL.90).aspx

in mysql, the timestamp should accept that value:
The TIMESTAMP data type is used for values that contain both date and time parts. 
TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. 

Open in new window


please confirm you are using mysql and not mssql