Subject Re: [IBO] Extracting Table names from a SQL select statement
Author Jason Wharton
Sam,

> Is there a way to use IBObjects to extract the table names from a SQL
> statment.
>
> For example, if a user provided the following string :
> (Completely made up example, the user could provide any SQL statement)
>
> "
> Select * from ADDRESS A, PERSON P WHERE
> A.PERSON_ID = P.PERSON_ID and P.CATEGORY NOT IN
> (
> SELECT CATEGORY_ID FROM PERSON_CATEGROY WHERE UNLAWFUL='Y'
> )
> "
>
> I could use IBObjects to extract
>
> 'ADDRESS', 'PERSON', 'PERSON_CATEGORY'
>
> as the list of referenced table names ?

Yes. It's in the TIB_Row object.

Look at the RelationNames[] property of the Fields[] property of your query.

(My spelling could be off.)

HTH,
Jason Wharton