If I have two tables and each table has about 10 fields.

Is there a way to determine the joining points between these two tables regardless if foreign keys are established?

Alternatively, I can write a VBA script that can go through the first table and grab each field of that table and test a COUNT join against each of the field in the second table. However, if there is a way in SQL, I would prefer to take that method.

The result set would return:

Table_1_Field_Name & Table_2_Field_Name

As a matter of fact, if there is a way to run it against the entire database, that would be great.

If there is a consistent naming convention you could use column names to find join candidates, however you are making an assumption. Is there documentation on the database in question?

1 Like