SQL LOAD/UNLOAD statements dont work via ODBC

SQL LOAD/UNLOAD statements dont work via ODBC

Postby avista » 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,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: SQL LOAD/UNLOAD statements dont work via ODBC

Postby Rick Lipkin » 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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: SQL LOAD/UNLOAD statements dont work via ODBC

Postby avista » Tue Sep 18, 2012 1: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,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 94 guests