Importar dados

Delphi

28/08/2003

Tenho 3 tabelas Paradox
Entrada / Saida / Geral

Quero apagar os dados da tabela Geral e depois
exportar os dados das tabelas Entrada e Saida para a tabela Geral

Como eu faco isso?


Evandro


Mardegan

Mardegan

Curtidas 0

Respostas

Adilsond

Adilsond

28/08/2003

Utilize uma query:

StartTransaction
try
delete from geral -> Comandos SQL
insert into geral select * from entrada -> Comandos SQL
insert into geral select * from saida -> Comandos SQL
commit
exception
rollback
end


GOSTEI 0
Bacalhau

Bacalhau

28/08/2003

Partindo do princípio que as tabelas têm a mesma estrutura, é assim

Geral.close;
Geral.emptytable;

Entrada.open;
Batchmove1.source := Entrada;
Batchmove1.destination := Geral;
Batchmove1. mode := batAppend;
Batchmove1.execute;
Saida.open;
Batchmove1.source := Saida;
Batchmove1.execute;

É claro que tens de ter um objectozinho no form chamado TBatchMove
abraço do bacalhau


GOSTEI 0
POSTAR