ozsenegal
ozsenegal

Reputation: 4133

SQL Server Copy records from one column to another

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.

Any ideias?

Upvotes: 3

Views: 1028

Answers (1)

Tim Robinson
Tim Robinson

Reputation: 54724

update tb_usuarios_voar set txt_password = convert(varchar, int_re_usu)

Upvotes: 7

Related Questions