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
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'

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.