FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SQL LOAD/UNLOAD statements dont work via ODBC
Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
SQL LOAD/UNLOAD statements dont work via ODBC
Posted: Fri Sep 14, 2012 10:20 AM

Hi,
I use Informix database and i have a problem
Sql statements LOAD and UNLOAD dont work from the application via ODBC
Program report syntax error

Some sugestions ?

Best regards,

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: SQL LOAD/UNLOAD statements dont work via ODBC
Posted: Fri Sep 14, 2012 12:45 PM
Did a quick Google search on the subject .. here is the link and the last suggestion:

Rick Lipkin

http://www.xtremevbtalk.com/archive/ind ... 73085.html


Again, unless you can do this from a batch file, I believe your best bet is going to be looping through recordsets and handling the file access manually. I.e. in pseudocode:


'UNLOAD
Open recordset with SELECT * FROM table
Open file for write access
Until recordset.EOF
{ Write record to file (with delimiters)
Move to next record
}
Close recordset
Close file

'LOAD
Open file for read access
Until file.EOF
{ Read line from file
Parse line (Split on delimiters) and generate SQL INSERT statement
Insert record into database using command .Execute method
}
Close file
Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: SQL LOAD/UNLOAD statements dont work via ODBC
Posted: Tue Sep 18, 2012 01:53 PM

Thanks Rick for reply,
Good solution,

Like i found on internet LOAD FROM and UNLOAD are not SQL statements ... They are only DbAccess options and DbAccess use own subrutines for that.
So i writed own functions

Regards,

Continue the discussion