How to get cardinality of relations between two tables in SQL Server using TSQL?

Viewed 940

I am using following code to get all tables that have a foreign key of the table in where clause which in this example is SolutionUser :

select 
    (select name from sys.tables 
     where object_id = fk.parent_object_id) Name 
from 
    sys.foreign_keys fk 
left outer join 
    sys.tables st on fk.referenced_object_id = st.object_id   
where 
    st.name='SolutionUser'

What I can't achieve is to get the cardinality of these relationships (one-to-one, one-to-many)

Is it possible to get these cardinalities using T-SQL ?

1 Answers
Related