recset Posted December 25, 2006 Share Posted December 25, 2006 I have an existing table, and I want to create a new column (with a default value), and have all of the records already in the table, have the new default value and column .... what SQL statement would accomplish this? Link to comment https://forums.phpfreaks.com/topic/31795-inserting-values-into-an-existing-db-sql/ Share on other sites More sharing options...
The Lost Faith Posted December 25, 2006 Share Posted December 25, 2006 ALTER TABLE db.tbl_name ADD COLUMN col_1 [VALUES] Link to comment https://forums.phpfreaks.com/topic/31795-inserting-values-into-an-existing-db-sql/#findComment-147475 Share on other sites More sharing options...
recset Posted December 26, 2006 Author Share Posted December 26, 2006 Thanks for responding.However, that doesn't work, the following statement does work:[code]ALTER TABLE `wisdom_backup` ADD Cases2 varchar(30)[/code]However how do I get it to show a default value for the new column???? Link to comment https://forums.phpfreaks.com/topic/31795-inserting-values-into-an-existing-db-sql/#findComment-147795 Share on other sites More sharing options...
fenway Posted December 27, 2006 Share Posted December 27, 2006 add "default 'your default value'". Link to comment https://forums.phpfreaks.com/topic/31795-inserting-values-into-an-existing-db-sql/#findComment-148365 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.