insert new column sql same value code example
Example 1: Insert and initialize a SQL column with value dependent on another column data
UPDATE table
SET col = new_value
WHERE col = old_value
AND other_col = some_other_value;
UPDATE table
SET col = new_value
WHERE col = old_value
OR other_col = some_other_value;
Example 2: default column value in sql same as other column
ALTER TABLE tablename ADD newcolumn type NOT NULL DEFAULT (0)
Go
Update tablename SET newcolumn = oldcolumn Where newcolumn = 0
Go