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)
 No foreign key in place?!

Author  Topic 

zdrose
Starting Member

1 Post

Posted - 2009-11-24 : 09:31:51
I just started my new job last week and found out my current company's database has set no foreign key relationships between tables and the database diagram function is never available as 'one number of db_owner role must be using database diagram functionality in order to set up the required database diagramming objects on the SQL Server' ALWAYS!

What is the most efficient way to find out each joined columns to use? Thanks in advance!

kbhere
Yak Posting Veteran

58 Posts

Posted - 2009-11-25 : 04:38:57
You are saying that there is no foriegn keys..
If there is no relations then how can you get joined columns??
Try to normalise your tables and include relationships among them..
Then, try to retrieve joined columns..

Balaji.K
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2009-11-25 : 05:10:12
data can be joined without formal FK's. formal FK's only prevent refetential integrity issues.
the company is probably just joining the tables by writing code to do so.

script the database out and go through each object one by one to work out the relationships (in test of course). start with like-named objects (or the smallest tables in size as they usually are the reference tables)...(unless you are not telling us that the tables are named mytable1, mytable2, and other****names, etc)...in which case..go to the last company that didn't hire you and beg them to re-consider


there are some scripts here (try under the FAQ's or on member tkizers blog) which attempt to suggest related tables by name/similar columns names, etc.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-11-25 : 05:20:14
no keys?

any indices?

or is everything a heap.

well -- at least if they come to you and say -- this process is taking ages...... you'll look like a database god when you deliver 100x speed-ups.

Every horrible dark and boding cloud has at least one very thin silver lining.

My sympathies....


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -