[SGVLUG] Meta-querying (perhaps OT...)

Emerson, Tom (*IC) Tom.Emerson at wbconsultant.com
Mon Jul 7 12:04:15 PDT 2008


This is more for the database guru's out there -- specifically, for DB2:
is there a way to perform a "meta" query on a database?  In particular,
I'd like to find out what tables contain a particular field (by name, or
possibly by structure as it's possible that the "name" of the field
isn't consistent across datasets)

This is (perhaps...) a feature I happen to like with TurobIMAGE
databases.  It may seem a little daunting at first, but it "encourages"
designing a database that is easy to maintain.  With IMAGE, you need to
specify the fields that will be used in the database prior to actually
placing them in datasets (tables).  Since the structure of the field is
kept independent of the table specification, you can't inadvertantly
define a "key" item as "varchar(12)" in one table and "numeric(9,3)" in
another (you have to explicitly do this by defining two different fields
and relating them as a key item, but the schema processor will stop and
show you the error of your ways...)

I *think* you can do this with MySQL, but only if you've set up
field-level security in your database (kind of a back-door approach --
you query the access-rights table for all tables containing the field
you are interested in...)

So, is what I'm after possible, or do I have to dump the schema to a
file and use something like grep?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.sgvlug.net/pipermail/sgvlug/attachments/20080707/bfbc29b1/attachment.html


More information about the SGVLUG mailing list