MySQL Forums
Forum List  »  Newbie

Incorrect use of DEFAULT NULL?
Posted by: John Buckley
Date: March 28, 2018 01:26PM

I have a create script as follows:

CREATE TABLE `log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timestamp` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`machine_id` int(11) NOT NULL,
`event` text NOT NULL,
`login_id` int(11) DEFAULT NULL,
`usage` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
)
ENGINE=InnoDB AUTO_INCREMENT=1896 DEFAULT CHARSET=latin1;

When I run this insert statement:
INSERT INTO log VALUES("0","1483766635","115","60","Rejected","","0")

I get:
Error Code: 1366.
Incorrect integer value: '' for column 'login_id' at row 1

I am obviously using DEFAULT NULL wrong or maybe I should use something else? When I take login_id value out of the statement I get a value count error.
login_id value is almost always null.

What is best/better way to do this? Many thanks

Options: ReplyQuote


Subject
Written By
Posted
Incorrect use of DEFAULT NULL?
March 28, 2018 01:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.