Hi,
I am using SQLyog 10.0, MySQL 5.0.84 and my schema looks like:
CREATE TABLE `test`
(
`testID` int(10) unsigned NOT NULL auto_increment,
`testValue1` varchar(255) NOT NULL,
`testValue2` tinyint(4) NOT NULL,
`testValue3` datetime NOT NULL,
`testValue4` text NOT NULL,
PRIMARY KEY (`testID`)
);
Whenever I try to insert a new row into the table using SQLyog, and I only enter one column value (eg. I may put 'xyz' into testValue1), I get the following error:
insert into `test` (`testID`, `testValue1`, `testValue2`, `testValue3`, `testValue4`) values (NULL, 'xyz', NULL, NULL, NULL)
Error Number: 1048
Column 'testValue2' cannot be null
This is obviously because there are no default values for each of the columns, but I have no idea why SQLyog is not handling this situation by leaving out all of the NULL fields, so the statement should be:
insert into `test` (`testValue1`) values ('xyz')
My problem is that I have to insert many rows into the database manually at the moment, and one of my tables has A LOT of fields. I have to manually go to each field, right click on it and go to Set To Empty String. This is a very long and frustrating process.
I can use MySQL Workbench as a workaround, as it does this with no problems, however I would like to switch to SQLyog as it seems quicker in the long run.
Is it possible to have SQLyog not insert (NULL) into every field, and instead have a default of an empty string, so that MySQL itself can handle it? Or is there an alternative that will solve the situation?
Thanks!