query1.Close;
query1.sql.add('select * from ":yourdb:yourtable"');
query1.open;
query1.first;
while not query1.eof do
begin
yourstr:=query1.fieldbyname('yourfieldname').asstring;
tempstr:='';
for i=i to length(yourstr) do
begin
if not (yourstr=' ') then tempstr:=tempstr+yourstr;
end;
query2.Close;
query2.sql.add('update ":yourdb:yourtable" set yourfieldname=:newvalue where yourtableindexfieldname=:indexvalue');
query2.ParamByName('newvalue').asstring:=tempstr;
query2.ParamByName('oldvalue').asstring:=query1.filedbyname('yourtableindexfieldname').asstring;
query2.ExecSQL;
end;