How to Inserting 0 To an AutoIncreament Field on MySql
Let say i have this table,
CREATE TABLE `refproductscale` ( `id` int(11) NOT NULL AUTO_INCREMENT, `scale` varchar(255) NOT NULL, `del` set('y','n') NOT NULL DEFAULT 'n', PRIMARY KEY (`id`) )
I dont know why, but everytime im inserting ‘zero’ as its id, suddenly it changes into an increament number.
But with this script, im able to insert ‘zero’ as its id. This is my script,
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; insert into refproductscale values(0, 'none', 'n');
All i have to do is use NO_AUTO_VALUE_ON_ZERO before i do insert query.
No Comments