LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown primary keys and foreign keys ina database

I would like to connect to a database and determine, on the fly, what columns are the foreign and primary keys for each table.  Is there any way to do this using the LabView Database connectivity toolkit or a SQL query?

Thank you!
Brad
0 Kudos
Message 1 of 5
(2,877 Views)

In principle, yes. One of the requirements of a relational database is that all its own internal structure must also be stored in relational tables. Now having said that, the way different database management systems store that information is highly application-specific. Check-out the documentation of the database you are using on the specifics of how to find the information using SQL queries.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(2,875 Views)
Thank you for your help.  Now that I know what to look for, I should be able to track down the information I need (it's for MS Access).

Brad
0 Kudos
Message 3 of 5
(2,873 Views)

Ok Access;

It's been a while, but as I recall there are "system tables" that define your database's structure. The one you're looking for I think is "MSysRelationships"

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(2,868 Views)
Found it, thanks!  For future reference (for anyone who might search for this topic)

Go to: Tools -> Options -> View and check "system" and "hidden" objects to explore the structure of these tables.  It's not recommended to edit them directly for obvious reasons, but will at least give an idea of how to query them.

Brad
0 Kudos
Message 5 of 5
(2,850 Views)