Board index » delphi » Copying data from AS/400 to Sybase

Copying data from AS/400 to Sybase

Hi, i am trying to create an application, who can copy AS/400 table to
Sybase table. It work ok, but not fast enough any idea how to optimize
this code or new idea?

______________

   DM_princ.Tab_source := It's a Ttable with CO400,
   DM_princ.Tab_destination := It's a Ttable with Sybase,

Var
  lrecord: Integer;

   DM_princ.Tab_destination.open;
   lTime := Time;
   lrecord:=0;
   while not DM_princ.Tab_source.Eof and (lrecord<1000) do Begin
     DM_princ.Tab_destination.append;
     for i:= 0 to DM_princ.Tab_source.FieldDefs.Count - 1 do
        if (DM_princ.Tab_destination.fields[i].datatype = ftDate) or
           (DM_princ.Tab_destination.fields[i].datatype = ftDateTime)
then
         DM_princ.Tab_destination.Fields[I].AsDateTime:=
             IntToDate(DM_princ.Tab_source.Fields[I].AsInteger)
        else
         DM_princ.Tab_destination.Fields[I].ASString:=
             DM_princ.Tab_source.Fields[I].ASString ;

      Inc(lrecord);
      DM_princ.Tab_source.next;
   end;

Thank's a lot

Luc

 

Re:Copying data from AS/400 to Sybase


The fastest way I know to get data into Sybase is using BCP. It is a command
based program and if you satisfy certain criteria, it can work in fast BCP
mode, as opposed to the normal slow BCP mode.

It it rather akward to use though and does not have programatic ways of
accessing it. Normally I create a batch file with parameters etc and shell
to the OS to call the BCP batch file.

George Aligianis

Quote
Luc Carbonneau wrote in message <3819F8DC.55F2B...@vmd.desjardins.com>...
>Hi, i am trying to create an application, who can copy AS/400 table to
>Sybase table. It work ok, but not fast enough any idea how to optimize
>this code or new idea?

>______________

>   DM_princ.Tab_source := It's a Ttable with CO400,
>   DM_princ.Tab_destination := It's a Ttable with Sybase,

>Var
>  lrecord: Integer;

>   DM_princ.Tab_destination.open;
>   lTime := Time;
>   lrecord:=0;
>   while not DM_princ.Tab_source.Eof and (lrecord<1000) do Begin
>     DM_princ.Tab_destination.append;
>     for i:= 0 to DM_princ.Tab_source.FieldDefs.Count - 1 do
>        if (DM_princ.Tab_destination.fields[i].datatype = ftDate) or
>           (DM_princ.Tab_destination.fields[i].datatype = ftDateTime)
>then
>         DM_princ.Tab_destination.Fields[I].AsDateTime:=
>             IntToDate(DM_princ.Tab_source.Fields[I].AsInteger)
>        else
>         DM_princ.Tab_destination.Fields[I].ASString:=
>             DM_princ.Tab_source.Fields[I].ASString ;

>      Inc(lrecord);
>      DM_princ.Tab_source.next;
>   end;

>Thank's a lot

>Luc

Other Threads