When adding a column to existing table with existing data, provide option to update the column to the default value for all existing rows.
In SQL it is possible, when adding a column with a default value to a table with existing data, to set the value of the column in the existing rows to the default value:
ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINTNAME} DEFAULT {DEFAULTVALUE}
[WITH VALUES]
I would like to select this option when adding a column to the table in the designer, and also be able to include the option when scripting the changes to the table - when a schema comparison is done, have the WITH VALUES option included in the script.
4
votes
Steve Jensen
shared this idea