Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to find tables to left outer join

Author  Topic 

alejo46
Posting Yak Master

157 Posts

Posted - 2012-02-13 : 10:34:42
Good morning
im started to learn sql server programming, and i've got this question:

In our production system in a database there are more than 100 tables.

i need to practice the different types of joins in multiple tables.

The problem arises how to identify which tables and colums i should do a join because there are houndreds of them.

ive tried to find out over the internet some scripts. and ive got decens of them, but is not what i expected i.e:

select object_name(fkeyid),
col_name(fkeyid, fkey) as column_name,
col_name(rkeyid, rkey) as referenced_column_name
from sysforeignkeys
where object_name(rkeyid) like '%Abon%'
order by constid
What i want is to see (graphically) the tree from the top to the bottom of related tables i.e :

main Table -> child table -> another child table - and so on

Ive heard the tools Management Studio (Sql server 2008) or Profiler (sql server 200) can i get something, if so how do i start with both of them.


the purpose i said before is to identify related tables which i could work for joing multiples tables.

Plase, i need yor help, and i´ll apprecaite your help in advance


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-13 : 10:37:51
see logic here for find recursive table relationships

http://visakhm.blogspot.com/2011/11/recursive-delete-from-parent-child.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-02-13 : 10:38:19
If you want to query a table, use sp_depends 'table name' to find the related objects

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-13 : 10:38:21
You need a data model to graphically show you the relationships...

Or the system catalog

You have to understand first what RDBMS means...

Use Google

http://www.sqlserver-training.com/introduction-to-rdbms-day-1-chapter-1/-



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -