SQL Server将记录从一列复制到另一列

时间:2022-12-11 22:14:30

How to pass data from one column to another column in the same table?i.e:

如何将数据从一列传递到同一表中的另一列?

create table tb_usuarios_voar
(
    int_id_usu int identity(1,1),
    int_re_usu int not null,
    txt_colaborador varchar(200) null,
    txt_cargo varchar(200) null,
    txt_chefearea_usu varchar(150) null,
    txt_estrutura varchar(200) null,
    txt_marca varchar(200) null,
    txt_unidade varchar(150) null
)

That is the original table.Then ive added a new column:

这是原始表格。然后我又增加了一个新专栏:

alter table tb_usuarios_voar add txt_password varchar(140) null

What i want is to copy all records from int_re_usu column to the new column txt_password.

我想要的是将int_re_usu列的所有记录复制到新的列txt_password。

Any ideias?

的念头吗?

1 个解决方案

#1


6  

update tb_usuarios_voar set txt_password = convert(varchar, int_re_usu)

#1


6  

update tb_usuarios_voar set txt_password = convert(varchar, int_re_usu)