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? Quote 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] Quote 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???? Quote 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'". Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.