# 1264 - Out of range value for column 'year' at row 1

2

Query :

INSERT INTO veiculo(nome,modelo,placa,ano) 
VALUES('teste','testeModel','ASD5647',2012)

Fields:

nome   | varchar
modelo | varchar 
placa  | varchar
ano    | int

Error reported:

  

# 1264 - Out of range value for column 'year' at row 1

Why are you having this error? How to solve?

    
asked by anonymous 20.10.2017 / 17:45

1 answer

5

There is nothing to do with "single quotes", columns type int do not need "quotation marks" in past values

This error:

  

1264 - Out of range value for column

Indicates that the value you entered exceeded the defined limit, you are probably not entering 2012 , but rather a totally different value (that is, the problem is in the data input) or maybe you have used something like DECIMAL(1,1) .

You can change the size with ALTER TABLE (if the type is not int ):

ALTER TABLE veiculos MODIFY COLUMN ano INT(4);

You can also choose the type DATE or YEAR(4) , I do not know what the advantages will be with the type of date columns, but maybe it is the use of functions for calculations.

Now if the problem really is in the year, the problem is in the data source.

    
20.10.2017 / 17:56