How to find dependencies between database tables in SQL Server 2012 -


i have blogging website has sql server 2012 on backend. building mobile app , post blogs directly backend.

i able insert post primary table, post not appearing on website.

i suspect there 1 or more tables contain additional data constituting blog post i'm unable find them.

is there efficient way find additional related tables? possible there "hidden" fields or tables in database?

first query give list of tables table references, , second give list of tables reference table. works if there referintial integrity set between tables.

declare @tablename  varchar(max) = 'mytable',         @schemaname varchar(max) = 'dbo'  select distinct        s.name schemaname,        o2.name tablename sys.foreign_keys fk join sys.objects o on fk.parent_object_id = o.object_id join sys.schemas s on o.schema_id = s.schema_id join sys.objects o2 on fk.referenced_object_id = o2.object_id join sys.schemas s2 on o2.schema_id = s2.schema_id o.name = @tablename       , s.name = @schemaname order schemaname,          tablename  select distinct        s.name schemaname,        o.name tablename sys.foreign_keys fk join sys.objects o on fk.parent_object_id = o.object_id join sys.schemas s on o.schema_id = s.schema_id join sys.objects o2 on fk.referenced_object_id = o2.object_id join sys.schemas s2 on o2.schema_id = s2.schema_id o2.name = @tablename       , s2.name = @schemaname order schemaname,          tablename 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -