moskitos moskitos - 5 months ago 11
MySQL Question

sql insert wrong value in BDD

here is my request,

INSERT INTO user(name,user_id,url,email,created,updated,phone,organisationID,role) VALUES ('Bastien Frey', '2196898165', 'https://cubber.zendesk.com/api/v2/users/2196898165.json', 'bastien.frey@incityz.com', '2016-01-19T16:21:07Z', '2016-01-19T16:21:07Z', '', '30567951','end-user'),('mathilde zimmer', '2297486669', 'https://cubber.zendesk.com/api/v2/users/2297486669.json', 'mathilde.zimmer91290@gmail.com', '2016-01-26T12:04:20Z', '2016-01-26T12:04:20Z', '', '36094152','end-user')


But it insert the wrong user_id in my table, do you think this is a code or a BDD problem ?
In my BDD i have something like that:
enter image description here

Answer

You have defined user_id column as signed integer and you attempted to insert a value greater than the upper limit of this data type (2147483647). MySQL truncated the value to the maximum allowed by the data type (you do not have strict sql mode enabled, otherwise you would have received an error). Check out the warnings with show warnings command.

Change the field's data type to unsigned int or to (unsigned) bigint.

Comments