Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Process Database Tables as Collection Items?
Message
From
28/07/2015 02:56:41
 
 
To
27/07/2015 17:09:39
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01622575
Message ID:
01622593
Views:
65
>I'd like to process all the tables of a VFP database, looking for column names that contain certain strings. Does an open database expose any collection properties/attributes? It would be nice to be able to do something like this:
>
>OPEN DATABASE MyDBC
>
>FOR EACH {table} IN MyDBC
>  ...
>
Hi All,

There is no object for this, only various functions to get parcial information, but you can do it using simple SQL, as this:
USE c:\path\database.DBC SHARED AGAIN IN 0 ALIAS 'mydbc' NOUPDATE
SELECT ObjectName FROM mydbc ;
	WHERE ObjectType = 'Table' and ObjectId in ;
	(SELECT parentId FROM mydbc WHERE ObjectType = 'Field' AND ObjectName like '%your-search%')
Edit: You just need to change the "database.dbc" name and "%your-search%", the result is the list of tables that have thie fieldname coincidence.


Best Regards.-
Fernando D. Bozzo
Madrid / Spain
Previous
Reply
Map
View

Click here to load this message in the networking platform