moskitos
moskitos

Reputation: 149

sql insert wrong value in database

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', '[email protected]', '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', '[email protected]', '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 database problem ? In my database i have something like that: enter image description here

Upvotes: 0

Views: 610

Answers (1)

Shadow
Shadow

Reputation: 34305

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.

Upvotes: 1

Related Questions