1

I am getting this error (1264 Out of range value for column 'estimate' at row 1) Does anyone know what this means as I am not to sure.

CREATE TABLE reading(
    meter_code CHAR(5) NOT NULL,
    `when` DATETIME NOT NULL,
    display DECIMAL(9,3) NOT NULL,
    estimate BIT NOT NULL DEFAULT 0,
    CONSTRAINT pri_reading 
PRIMARY KEY (`when`, meter_code),
    CONSTRAINT reading_FK
FOREIGN KEY (meter_code)
    REFERENCES meter (`code`) 
    ON UPDATE CASCADE 
    ON DELETE CASCADE );

This is what i am trying to insert.

INSERT INTO reading VALUES ('G1','2016.11.01','200','1');
2
  • 1
    Remove the ' ' from the '1' and retry
    – Norbert
    Aug 8, 2017 at 16:15
  • Yep that worked thank you :D
    – Liam U
    Aug 8, 2017 at 16:17

2 Answers 2

3

BIT data type accepts only 0 and 1, b'0' and b'1' or 0b0 and 0b1. The string '1' is not a valid BIT value.

Also note that '2016.11.01' is not a valid DATETIME value. You should use either '2016-11-01' or '2016-11-01 00:00:00'.

1
  • Thanks for your reply
    – Liam U
    Aug 8, 2017 at 18:59
0

Please increase the type length of your column "estimate" or change to string type

1
  • type lens == type length?
    – Barmar
    Aug 8, 2017 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.