Query to find orphan tables

The following query will fetch the tables that doesn’t have relationships.

Select ST.[Name] as “Orphan Tables”

from Sys.Foreign_Keys as SFK Right Join Sys.Tables as ST

On ST.object_id = SFK.parent_object_id Or

ST.object_id = SFK.referenced_object_id

Where SFK.type is null