SQL References by Roman

How to copy column data to another column using SQL

The following SQL statement shows how to copy the data from one column to another.

It will replace any existing values in the destination column, so be sure to know exactly what you’re doing and use the WHERE statement to minimize updates (e.g., WHERE destination_column IS NULL ).

UPDATE table 
SET destination_column = source_column
WHERE destination_column IS NULL

Comments