realmente, bem melhor, menos codigo. mas como eu faria pra me concetar ao outro banco, fora da aplicacao? e outro problema, tenho um campo que armazena uma foto (Blob), desse jeito, como eu faria para importar esse campo??
To: delphi-br@yahoogrupos.com.br From: stephen.wil...@ipswichhospital.nhs.uk Date: Fri, 26 Jun 2009 13:47:20 +0100 Subject: RE: [delphi-br] Problema de Lentidão (SQL) Bom dia, Fernando Poderia fazer isso em uma operacao, assim: Insert Into TabelaDestino(Campo1,ampo2,Campo3) Select Campo1,Campo2,Campo3 >From TabelaFonte ?? Sera muito rapido (menos que1 sec para 4000 registros em meus dados) - talvez demasiado rapido para mostrar progressao com um progressbar Atenciosamente Steve -----Original Message----- > > > > Opa, > > Sou iniciante em delphi, to com o seguinte problema: > > Tenho que importar dados de uma tabela para a outra, seus campos sao > iguais. > uso a seguinte logica: > > tenho duas querys no form, uma qry_fonte(de onde vou pegar os dados da > tabela que quero importar), e colocar na outra tabela que criei, na > qry_Destino. > > de primeiro, faco um select * pra pegar tds os campos da tabela fonte, e > depois, faco um insert campo a campo na tabela de destino, ex: > > ---------------------------------------------------------- > QRY_Fonte.sql.Clear; > QRY_Fonte.SQL.Add('Select * From [TabelaFonte]'); > QRY_Fonte.Open; > while Not QRY_Fonte.Eof do > begin > with QRY_Destino do > begin > > sql.Clear; > Sql.Add('Insert Into [TabelaDestino] ('); > SQL.Add('campo1, campo2, campo3'); > SQL.Add(') Values ('); > SQL.Add(QuotedStr(QRY_Fonte.FieldByName('Campo1').AsString)+','); > SQL.Add(QuotedStr(QRY_Fonte.FieldByName('Campo2').AsString)+','); > SQL.Add(QuotedStr(QRY_Fonte.FieldByName('Campo3).AsString)+','); etc... > ExecSql; > ProgressBar1.Position := ProgressBar1.Position + 1; > Application.ProcessMessages; > QRY_Fonte.Next; > > end; > end; > qry_Fonte.close; > > ------------------------------------------------ > > Funciona, mais ta MUIITOO lento!!! > pra importar 150 reg de uma tabela pra outra demora um pouco mais de 1 > Minuto. > e tenho tabelas aqui com mais de 8.000. > > oq pode ta errado, e se alguem conhece uma forma melhor e mais rapida de > manipular esses dados? > > Atenciosamente > Fernando Pires > > __________________________________________________________ > Conheça os novos produtos Windows Live! Clique aqui. > http://www.windowslive.com.br > > [As partes desta mensagem que não continham texto foram removidas] > > > -- ....................................................... Eduardo Silva dos Santos DRD SISTEMAS (27) 3218-4201 (27) 9961-7095 MSN: eduardo....@gmail.com Site: http://www.drdsistemas.com.br/ ....................................................... [As partes desta mensagem que não continham texto foram removidas] ------------------------------------ -- <<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>> *************************************************************************** This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, any reading, printing, storage, disclosure, copying or any other action taken in respect of this e-mail is prohibited and may be unlawful. If you are not the intended recipient, please notify the sender immediately by using the reply function and then permanently delete what you have received. Content of emails received by this Trust will be subject to disclosure under the Freedom of Information Act 2000, subject to the specified exemptions, including the Data Protection Act 1998 and Caldicott Guardian principles. This footnote also confirms that, unless otherwise stated, this email message has been swept by Sophos Anti-virus for the presence of computer viruses. *************************************************************************** _________________________________________________________________ Novo Internet Explorer 8. Baixe agora, é grátis! http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8 [As partes desta mensagem que não continham texto foram removidas]