MySQL table: BIT(1) not null default b'1', however, always default to '0' -


this how created table:

create table `item_spa_cust` (     `id` int(10) not null auto_increment,     `spa_id` int(10) null default null,     `type` varchar(20) not null collate 'latin1_swedish_ci',     `is_valid` bit(1) not null default b'1',     `company_name` varchar(50) null default null collate 'latin1_swedish_ci',     `custno` varchar(6) null default null collate 'latin1_swedish_ci',     primary key (`id`),     index `fk_item_spa_cust_item_spa` (`spa_id`),     constraint `fk_item_spa_cust_item_spa` foreign key (`spa_id`) references `item_spa` (`id`))  ; 

i expecting is_valid field default '1' set it, however, it's defaulting '0'.

i'm confused this, please help.

you should use 1, rather b'1'

that being said, in sqlfiddle, works expected.

if you're inserting , looking default value, should not specify in insert query.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -