将一个单元格中的值插入同一记录中的另一个单元格

时间:2021-07-06 15:41:58

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

如何将一次单元格中的值插入到表中每条记录的同一记录中的另一个单元格中,从目标中覆盖原始值?这是一次性查询。使用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)  
?

1 个解决方案

#1


Try:

update yourtable set destination = origin;

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

如果没有where子句,这将适用于表中的每一行。

#1


Try:

update yourtable set destination = origin;

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

如果没有where子句,这将适用于表中的每一行。