try
Database.StartTransaction;//提交事务
with Query do begin
Sql,Clear;
Sql.Add( 'INSERT INTO TABLE1 (column1,column2,...) SELECT column1,column2,... FROM TABLE2 WHERE 条件 ' );
Sql.Add( 'DELETE TABLE1 WHERE 条件 ' );
ExecSql;
end;
except
Database.Rollback;//出错回滚
end;
OK?