Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Given a field in data.dbc get the table
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
01257776
Message ID:
01257786
Vues:
26
>I have a scenario where I need to go to the DBC to find a field's table name. In this scenario, I am assured that field names in the DBC are unique.
>
>Has anyone done this before, in an efficient SQL statement. I know this can be done with multiple passes on the DBC inspecting [objectname], [objecttype] and [parentid]...
>
>Any help is most appreciated.

Try
USE test.dbc ALIAS mydbc SHARED
lcFieldName = "pk"
SELECT db1.ObjectName AS TableNAme FROM mydbc db1 ;
	JOIN mydbc db2 ON db2.parentid = db1.Objectid ;
	WHERE db1.Objecttype = "Table" ;
		AND db2.Objecttype = "Field" AND UPPER(db2.ObjectName) = UPPER(lcFieldName)
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform