Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select statement to get table names in .dbc via ODBC
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00165543
Message ID:
00166101
Views:
27
>>>I have a VFP database (.dbc) set up in the Contol Panel's ODBC data sources. Is there a select statement I can send to the ODBC data source to retrieve the table names within the database (.dbc)?
>>
>>Try this:
>>
>>lnHandle=sqlconnect("You_Connection_Name")
>>=SQLTABLES(lnHandle,"Table", "CrsTables")
>>
>>I have a VFP ODBC connection to another VFP Database, and this works for me -- returns 1 record for each table in the DBC. Works for views in the DBC as well, just substitute View for Table. See VFP help for SQLTables() and SQLConnect() function parameters.
>
>I should have said I want to send the select from another product besides VFP and do it totally outside VFP thru the ODBC data source. Sometimes I've seen "select sys.objects where field = x", etc. in other packages. How do I do this? The SQLTABLES() is doing this automatically for you by sending some SQL directive to get the info.
>
>Richard

You would use the VFP SQLExec() function to send the SQL command. You would need to research the backend to determine what table(s) this information is stored in. In Oracle, there is an ALL_TABLES table where you can select table names based on criteria contained in the columns of that table. There is an ALL_OBJECTS table, all_views, ALL_SYNONYMS, ALL_TAB_COLUMNS [which is the one you would probably want in Oracle], etc. In the ALL_TAB_COLUMNS table, you have the columns of all the tables, views and clusters accessible to the user. You have the following columns in that table [Oracle 7.x]:

OWNER, TABLE_NAME, COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE, COLUMN_ID, DEFAULT_LENGTH, DATA_DEFAULT, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform