Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Base Tables
Message
From
20/12/2017 12:50:40
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL Base Tables
Miscellaneous
Thread ID:
01656587
Message ID:
01656587
Views:
77
I need to export 300+ SQL tables to Foxpro DBFs.
Don't ask why the customer just wants it.

I can open the SQL table that has all the table names in it.
My plan is to scan that table and get each name then do a SELECT * from (that table name)
Then copy to (That table name)

I running into Syntax issues


I do not know how toi pass the table name into the next Select statement
nor how to select that table and copy it to a folder using the table name selected

I have this so far

STORE SQLStringConnect ("Driver=SQL Server;UID=;pwd=;server=;Database=") TO gnConnect

*** I removed the login credintials


SQLEXEC(gnConnect,lcSQLCMD,'TableNames')

* To avoid a busy connection error this must be done
* after SQLEXEC() is on complete
IF SQLGetProp( gnConnect , 'ConnectBusy')
SQLCANCEL(gnConnect )
ENDIF


SELECT TableNames


GOTO Top
SCAN WHILE !EOF()
Tname=''
SaveTo=''
Tname=TableNames.Table_Name
SaveTo="c:\a\"+Tname
lcSQLCMD=[ select * FROM ?Tname];

SQLEXEC(gnConnect,lcSQLCMD,'SelectedTable')
* To avoid a busy connection error this must be done
* after SQLEXEC() is on complete
IF SQLGetProp( gnConnect , 'ConnectBusy')
SQLCANCEL(gnConnect )
ENDIF
SELECT SelectedTable

ENDSCAN
Next
Reply
Map
View

Click here to load this message in the networking platform