Is there any way to find out the tables relationship?

Raj

There is a very old product, that has more than 1500 tables and there is no foreign key relationship defined between tables.

Is there any way so we can find out the relationship of tables?

Thanks!

Kritner

If there's no relationships between tables then there's no relationships between tables. Anything that could be done would be somewhat guesswork and the results will be mediocre at best, and that would all depend on how the original developers named the tables and columns.

Something that could potentially get you started would be the following query:

select distinct t1.name
from sys.columns s1
inner join sys.tables t1 on t1.object_id = s1.object_id
inner join sys.columns s2 on s1.name = s2.name
 and s1.object_id <> s2.object_id
inner join sys.tables t2 on t2.object_id = s2.object_id

this will get you a list of tables that have a column with an exact match with another table. Note there will be a lot of noise returned from this query (most likely) but it might be a help to get you started.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Best way to filter a relationship from a twig template

来自分类Dev

Is there any way to call a function by another function argument?

来自分类Dev

Fast way to find if a string is in an array

来自分类Dev

Is there a way I can import relationship between elements in Enterprise Architect?

来自分类Dev

Best way to implement parent child relationship

来自分类Dev

Is there any way to exclude branches from showing in GitK?

来自分类Dev

Is there any way to avoid sub queries?

来自分类Dev

How to find orphaned records that point to different tables (paramerization required)?

来自分类Dev

A way to access the defaullt sorting method from Data Tables in Vuetify

来自分类Dev

iPad app transferred to different account, any way to keep keychain access

来自分类Dev

Check if specific form is submitted (in any way)

来自分类Dev

Find out the list of tests that are skipped

来自分类Dev

Find matching type for one of multiple joined tables

来自分类Dev

Is there a way to print a Groovy Collection out in a pastable format?

来自分类Dev

Is there any way to prevent page load of images with javascript?

来自分类Dev

Find out if I'm on the unity thread

来自分类Dev

How to find out Mule flow status

来自分类Dev

Any way to parse Less in .net?

来自分类Dev

any_of与find_if

来自分类Dev

Relationship between tables with two foreign keys

来自分类Dev

Is there any way to create rounded corners for SVG ARC?

来自分类Dev

Find nearest neighbour in a more pythonic way

来自分类Dev

Is there any way to get the page numbers in a PDF of a search pattern?

来自分类Dev

In Slick 3.0 is there a way to declare Tables without using a Specific JDBC Driver

来自分类Dev

Kotlin中泛型中的<out Any?>和<*>之间的区别

来自分类Dev

How to find out what the source of an NS Log is?

来自分类Dev

Any way to interpret pstree?

来自分类Dev

Find out glibc compilation options

来自分类Dev

Is there any way to install a transient package?

Related 相关文章

  1. 1

    Best way to filter a relationship from a twig template

  2. 2

    Is there any way to call a function by another function argument?

  3. 3

    Fast way to find if a string is in an array

  4. 4

    Is there a way I can import relationship between elements in Enterprise Architect?

  5. 5

    Best way to implement parent child relationship

  6. 6

    Is there any way to exclude branches from showing in GitK?

  7. 7

    Is there any way to avoid sub queries?

  8. 8

    How to find orphaned records that point to different tables (paramerization required)?

  9. 9

    A way to access the defaullt sorting method from Data Tables in Vuetify

  10. 10

    iPad app transferred to different account, any way to keep keychain access

  11. 11

    Check if specific form is submitted (in any way)

  12. 12

    Find out the list of tests that are skipped

  13. 13

    Find matching type for one of multiple joined tables

  14. 14

    Is there a way to print a Groovy Collection out in a pastable format?

  15. 15

    Is there any way to prevent page load of images with javascript?

  16. 16

    Find out if I'm on the unity thread

  17. 17

    How to find out Mule flow status

  18. 18

    Any way to parse Less in .net?

  19. 19

    any_of与find_if

  20. 20

    Relationship between tables with two foreign keys

  21. 21

    Is there any way to create rounded corners for SVG ARC?

  22. 22

    Find nearest neighbour in a more pythonic way

  23. 23

    Is there any way to get the page numbers in a PDF of a search pattern?

  24. 24

    In Slick 3.0 is there a way to declare Tables without using a Specific JDBC Driver

  25. 25

    Kotlin中泛型中的<out Any?>和<*>之间的区别

  26. 26

    How to find out what the source of an NS Log is?

  27. 27

    Any way to interpret pstree?

  28. 28

    Find out glibc compilation options

  29. 29

    Is there any way to install a transient package?

热门标签

归档