terenceyuen Posted May 14, 2007 Share Posted May 14, 2007 I would like to change the type of Null to NO,what is the command for this? I've tried this one, but no luck to get it work. ALTER TABLE claims_summary ALTER COLUMN advance_call_details SET NOT NULL; +----------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------+--------------+------+-----+---------+-------+ | client_id | int(11) | | | 0 | | | client_code | varchar(30) | | PRI | | | | club_id | int(11) | | | 0 | | | club_code | varchar(30) | | PRI | | | | yearclaim | int(10) | | PRI | 0 | | | advance_call | double(16,4) | YES | | 0.0000 | | | additional_call | double(16,4) | YES | | 0.0000 | | | supplementary_call | double(16,4) | YES | | 0.0000 | | | release_call | double(16,4) | YES | | 0.0000 | | | advance_call_details | varchar(240) | YES | | | | +----------------------+--------------+------+-----+---------+-------+ Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/ Share on other sites More sharing options...
btherl Posted May 14, 2007 Share Posted May 14, 2007 The manual is here: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/#findComment-252517 Share on other sites More sharing options...
bubblegum.anarchy Posted May 14, 2007 Share Posted May 14, 2007 ALTER COLUMN is used only to modify the default value of a column. The entire column definition is required to update the NULL/NOT NULL value of a column, as follows: ALTER TABLE MODIFY advance_call_details varchar(240) NOT NULL DEFAULT 'undefined' COMMENT 'advances call details' Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/#findComment-252535 Share on other sites More sharing options...
terenceyuen Posted May 14, 2007 Author Share Posted May 14, 2007 ALTER COLUMN is used only to modify the default value of a column. The entire column definition is required to update the NULL/NOT NULL value of a column, as follows: ALTER TABLE MODIFY advance_call_details varchar(240) NOT NULL DEFAULT 'undefined' COMMENT 'advances call details' Sorry, can you explain the purpose from the beginning 'undefined' COMMENT 'advances call details' I don't really understand. PS: I'm using Mysql 3.xx Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/#findComment-252571 Share on other sites More sharing options...
bubblegum.anarchy Posted May 14, 2007 Share Posted May 14, 2007 DEFAULT 'indefined' is the default value assigned to the column if none is provided and COMMENT 'advance call details' is like adding comments in programming code but the comment here is associated to the column and should describe the purpose of the information stored in the column. Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/#findComment-252577 Share on other sites More sharing options...
terenceyuen Posted May 14, 2007 Author Share Posted May 14, 2007 ALTER TABLE MODIFY advance_call_details varchar(240) NOT NULL DEFAULT 'undefined' Where can I define the table name "claims_summary" in this syntax?? Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/#findComment-252579 Share on other sites More sharing options...
bubblegum.anarchy Posted May 14, 2007 Share Posted May 14, 2007 ALTER TABLE MODIFY advance_call_details varchar(240) NOT NULL DEFAULT 'undefined', MODIFY claims_summary text NOT NULL FYI: blob/text can not have a default value Quote Link to comment https://forums.phpfreaks.com/topic/51260-how-alter-work-on-changing-the-type-of-null/#findComment-252586 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.