The following program reads table from MS SQL and writes it into D3
file
*********************************************
program conv.SQL
include GP_TERM.LIB, GPTerm.COMMON
aTables = ''
aTables<-1> = 'SCL_MOVE'
aTables<-1> = 'SCL_NAKL'
oDBHandler = ''
 sConnectionString = 'Driver={SQLServer};Server=ServerPath
\ServerName;Database=MYDATABASE;Uid=MyUser;Pwd=MyPwd;'
sDBOptions = 'NODIALOG'
DelayValue = 20
DelaySub = 'GPTerm.DefDelaySub'
MPstartEnd = 1
execute "run dm,bp, xcs-on" capturing NULL
echo off
call GP.ODBCDatabaseOpen( oDBHandler, sConnectionString, sDBOptions )
if oDBHandler<1> # -1 then
 for i=1 to dcount( aTables, @am )
  open 'dt.' : aTables<i> to dt.tmp else
   crt 'cant open dt.' : aTables<i>
   exit
  end
  execute 'clear-file dt.' : aTables<i> capturing NULL
  oRSHandler = ''
  sSQLString = 'select * from [dbo].[' : aTables<i> : ']'
  sRSOptions = 'NONE'
  call GP.ODBCRecordsetOpen( oDBHandler, oRSHandler, sSQLString,
sRSOptions )
  if oRSHandler<1> # -1 then
   loop
    sOperation = 'IsEOF'
    sRetVal = ''
    call GP.ODBCRecordsetFn( oRSHandler, sOperation, sRetVal )
    if sRetVal = 0 then
     sOperation = 'ReadRowMoveNext'
******* ReadRows method can reads many rows at once. It is increases
speed up to 10th times
     sRetVal = ''
     call GP.ODBCRecordsetFn( oRSHandler, sOperation, sRetVal )
     write sRetVal on dt.tmp, sRetVal<1>
    end else
     exit
    end
   repeat
   close dt.tmp
   call GP.ODBCRecordsetClose( oRSHandler )
  end else
   crt 'error while GP.ODBCRecordsetOpen'
   close dt.tmp
   exit
  end
 next i
 call GP.ODBCDatabaseClose( oDBHandler )
end else
 crt 'error while GP.ODBCDatabaseOpen'
end
echo on
 stop
*************************************
Any comments, please