Jump to content

[SOLVED] set default help


sasori

Recommended Posts

i got a problem doing a manual alteration of a column, whenever i tried to set a default value

of 0 to a column which was presently set to NULL(e.g the cust_id primary key), it doesn't affect the column at all,

 

mysql6kj4.jpg

 

aren't there any other way to set the default value to 0 manually? coz just like what i said it doesn't affect it manually,  ???

Link to comment
https://forums.phpfreaks.com/topic/121057-solved-set-default-help/
Share on other sites

 

One thing, your cust_id is set to auto_increment. That means that as soon as any new INSERT query is add mysql will automatically update cust_id to the next Auto ID. Thus leave the need for a default of 0 obsolete

 

If you are manually setting cust_id then you need to remove auto_increment.

 

This code might work for you.

 


ALTER TABLE `customer` CHANGE `cust_id` `cust_id` INT( 32 ) NOT NULL DEFAULT '0'

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.