将表A字段值赋给B字段的sql
1.某一条条记录(ID=0)
Update TableName set A=(select B from TableName where ID=0) where ID=0
2.所有记录
declare @a varchar(50),@b varchar(50) ,@c varchar(50),@id int
declare pcd_cursor cursor for
select A,B,C,ID from TableName
open pcd_cursor
fetch next from pcd_cursor into @a ,@b,@c,@id
while(@@fetch_status=0)
begin
update TableName set A=@b where id=@id
FETCH NEXT FROM pcd_cursor into @a ,@b,@c ,@id
end
close pcd_cursor
deallocate pcd_cursor