SQL Server Copying records from one column to another

How to transfer data from one column to another column in the same table? ie:

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
)

This is the source table. Then jav added a new column:

alter table tb_usuarios_voar add txt_password varchar(140) null

I want to copy all the entries from the int_re_usu column to the new txt_password column.

Any ideas?

+3
source share
1 answer
update tb_usuarios_voar set txt_password = convert(varchar, int_re_usu)
+6
source

Source: https://habr.com/ru/post/1773024/


All Articles