Reputation: 155
I know i want to use an update statement but im having trouble with the structure of the query
Upvotes: 2
Views: 118
Reputation: 5145
The first of the following 2 SQL statements will create the new column in the table, and the second, update
statement will populate the new column from the old column.
alter table Table1 add newColumn char(32);
update table1 set newColumn=oldColumn;
commit;
Upvotes: 1
Reputation: 700840
You can't create a new column using an update, you have to do that first. Then it's just as simple as:
update TheTable set NewColumn = OldColumn
Upvotes: 1