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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Database Help

Author  Topic 

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-20 : 22:35:06
Hi guys Please advise me!

Scenario is "Client"provide a database(has 48 columns) and db has no PK AND FK relation and client don't have any ER Diagram and anything. I want to find out a relation of these tables and after that i need few tables to populate my company database. My question is what is the best and fast way to find out relationship of tables. And i don't know which one is PK. I have two option
1) GO THROUGH all tables and find out relation manually and use join to join the table and get the information/tables that i need

2) USE "REVERSE ENGINEERING" TO ERWIN DATA MODELING TOOL TO GET ER DIAGRAM.

Please advise me easy/fast way. Please don't hesitate if my question is not clear. I know there is lot of gurus can help me. Your help/reply help me a lot. Thanks in advance.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-11-20 : 23:08:25
A database contains objects (tables, stored procedures, functions, and other objects).

A table has columns.

If there are no relationships defined at all, then you're going to have to look it over yourself and figure it out.

Looking at the Stored Procedures (if there are any) or the queries executed, will be giant clues to figuring out what the relationships are/should be.

ER tools work by looking at the keys defined. If there are none, they won't help.

Rule of thumb -- any time a relationship CAN be enforced, it SHOULD be enforced.
Go to Top of Page

jscot
Posting Yak Master

106 Posts

Posted - 2010-11-20 : 23:15:11
Thanks for Prompt reply!

How about If i create PK and then "Reverse Engineering" ? is that work?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-21 : 03:13:44
Won't give you relationships. Will just add a meaningless primary key.

quote:
If there are no relationships defined at all, then you're going to have to look it over yourself and figure it out.


--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -