Boris Callens
Boris Callens

Reputation: 93297

Insert a value from one cell into another cell from the same record

How can I insert a value from once cell into another cell from the same record for each record in a table, overwriting the original value from the destination? It's a one time query. Using Sql server 2008

e.g.:

origin|destination
------|-----------
1     | A
2     | B
3     | C

to

origin|destination
------|-----------
1     | 1
2     | 2
3     | 3

update into myTable(destination)  
?

Upvotes: 0

Views: 2071

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 992767

Try:

update yourtable set destination = origin;

Without a where clause, this will apply to every row in the table.

Upvotes: 4

Related Questions