Subject Re: [firebird-support] Copy Table to Another Database
Author LtColRDSChauhan


On Tue, Nov 21, 2017 at 4:12 PM, Dimitry Sibiryakov sd@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
21.11.2017 10:01, LtColRDSChauhan rdsc1964@... [firebird-support] wrote:
> How can I copy all records of a table to another table in different database. The tables
> having same design.

   Use "execute statement on external datasource".


Thanks SD.
Please see if the under mentioned procedure is good enough:
 
SET TERM ^ ;
ALTER PROCEDURE COPY_theTABLE
AS
declare variable FIELD_1 varchar(80);
declare variable FIELD_2 varchar(80);
BEGIN
    for select p.FIELD_1, p.FIELD_2 from the_TABLE into :FIELD_1, :FIELD_2
    do execute statement
        ('insert into the_TABLE values(?)')
        (:FIELD_1, :FIELD_2)
    ON EXTERNAL 'ExternalServer:C:\External_Target.FDB'
    AS USER 'SYSDBA' PASSWORD 'masterkey';
END^
SET TERM ; ^


--
   WBR, SD.


------------------------------ ------

------------------------------ ------

++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++ ++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/ resources/documents/

++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++ ++++++
------------------------------ ------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-digest@ yahoogroups.com
    firebird-support-fullfeatured@ yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscribe@ yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/ us/yahoo/utos/terms/