Pelican Parts
Parts Catalog Accessories Catalog How To Articles Tech Forums
Call Pelican Parts at 888-280-7799
Shopping Cart Cart | Project List | Order Status | Help



Go Back   Pelican Parts Forums > Miscellaneous and Off Topic Forums > Off Topic Discussions


Reply
 
LinkBack Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.
Author
Thread Post New Thread    Reply
Registered
 
Scott at Pelican Parts's Avatar
 
Join Date: Jun 2005
Location: Los Angeles
Posts: 740
Garage
SQL Server experts - I need your help!!

I have a database I am trying to make sense of. It has about 100 tables (all named in German) and each of those tables has plenty of fields (all named in German).

I need to figure out the relationships between all the fields/tables (assume the related fields share the same name among the tables).

Is there a piece of software out there that would analyze the field names and put together the relationships for me, ideally presenting them in a graphical format? I could do it manually, but that would take a week.

- Scott

Old 03-28-2008, 09:24 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #1 (permalink)
Registered
 
TheMentat's Avatar
 
Join Date: Dec 2004
Location: Ocean Park, BC
Posts: 2,451
Garage
Pretty sure Microsoft Visio will do it. If I recall, it doesn't "organize" the drawing well, and it might come out looking like spaghetti.
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant

Last edited by TheMentat; 03-28-2008 at 09:27 AM..
Old 03-28-2008, 09:25 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #2 (permalink)
Registered
 
TheMentat's Avatar
 
Join Date: Dec 2004
Location: Ocean Park, BC
Posts: 2,451
Garage
Quote:
Originally Posted by TheMentat View Post
Pretty sure Microsoft Visio will do it. If I recall, it doesn't "organize" the drawing well, and it might come out looking like spaghetti.

I should also mention, that I don't think it will establish relationships between fields unless there is an explicit foreign key relationship.
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant
Old 03-28-2008, 09:29 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #3 (permalink)
Registered
 
id10t's Avatar
 
Join Date: Mar 2003
Posts: 10,346
The tools from SQL 2k allow a visual representation (think it is in the enterprise manager thingie) , but its been forever since I've used MSSQL...
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.”
Old 03-28-2008, 09:32 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #4 (permalink)
Registered
 
Scott at Pelican Parts's Avatar
 
Join Date: Jun 2005
Location: Los Angeles
Posts: 740
Garage
I should emphasize that these tables were imported into SQL Server from a text file or something, so there are no existing relationships that I'm aware of -- these are just raw tables. What I'm trying to do is determine the relationships, not just display them.

Thanks again.
Old 03-28-2008, 09:39 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #5 (permalink)
The Unsettler
 
stomachmonkey's Avatar
 
Join Date: Dec 2002
Location: Lantanna TX
Posts: 23,885
Send a message via AIM to stomachmonkey
Quote:
Originally Posted by Scott at Pelican Parts View Post
I should emphasize that these tables were imported into SQL Server from a text file or something, so there are no existing relationships that I'm aware of -- these are just raw tables. What I'm trying to do is determine the relationships, not just display them.

Thanks again.


If there are no existing relationships in the text file then there is nothing out there that is going to automagically figure it out.
__________________
"I want my two dollars"
"Goodbye and thanks for the fish"
"Proud Member and Supporter of the YWL"
"Brandon Won"
Old 03-28-2008, 09:54 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #6 (permalink)
 
Registered
 
billwagnon's Avatar
 
Join Date: Jun 2001
Location: St. Louis Missouri
Posts: 1,454
To me, the German would suggest it's an SAP database. You might be able to find an SAP reference that would help you make sense of the table & field names.
Old 03-28-2008, 10:04 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #7 (permalink)
Registered
 
TheMentat's Avatar
 
Join Date: Dec 2004
Location: Ocean Park, BC
Posts: 2,451
Garage
Quote:
Originally Posted by Scott at Pelican Parts View Post
I should emphasize that these tables were imported into SQL Server from a text file or something, so there are no existing relationships that I'm aware of -- these are just raw tables. What I'm trying to do is determine the relationships, not just display them.

Thanks again.
yikes...

I can't think of anything off the shelf. But if I were to do it manually, I'd do it by running queries on the system tables for the DB. Find out which fieldnames occur more than once in the DB, and then find out which tables they occur in.
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant
Old 03-28-2008, 10:06 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #8 (permalink)
Cars & Coffee Killer
 
legion's Avatar
 
Join Date: Sep 2004
Location: State of Failure
Posts: 32,246
DBA wanna-be here.

I'd think you'd have to know the data model to automate that kind of thing. If it were even possible to do what you are asking, all of the keys would have to be named the same in each table they are used. One deviation could throw everything off.

I don't know of any tool that you can feed a database and it will generate a data model. We use the Rational suite around here to do the opposite (use the data model to generate the database).
__________________
Some Porsches long ago...then a wankle...
5 liters of VVT fury now
-Chris

"There is freedom in risk, just as there is oppression in security."
Old 03-28-2008, 11:08 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #9 (permalink)
Registered
 
TheMentat's Avatar
 
Join Date: Dec 2004
Location: Ocean Park, BC
Posts: 2,451
Garage
Try this:

select c.name as ColumnName
, o.name as TableName
, count(cc.name) as NumCols
from
sysobjects o
join syscolumns c
on c.id = o.id
and o.xtype = 'U'
left join syscolumns cc
on c.name = cc.name
join sysobjects co
on cc.id = co.id
and co.xtype = 'U'
group by c.name, o.name
order by NumCols desc, ColumnName, TableName



ignore all of the columns that have NumCols = 1
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant
Old 03-28-2008, 11:09 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #10 (permalink)
Registered
 
TheMentat's Avatar
 
Join Date: Dec 2004
Location: Ocean Park, BC
Posts: 2,451
Garage
Quote:
Originally Posted by legion View Post
DBA wanna-be here.

I'd think you'd have to know the data model to automate that kind of thing. If it were even possible to do what you are asking, all of the keys would have to be named the same in each table they are used. One deviation could throw everything off.

I don't know of any tool that you can feed a database and it will generate a data model. We use the Rational suite around here to do the opposite (use the data model to generate the database).

I would second this... the code I provided will hopefully get you started on establishing relationships between the tables based on the column names only.


I should also say, that I'm not in any way a DB professional either... so my advice is probably only worth what it cost you!
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant
Old 03-28-2008, 11:12 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #11 (permalink)
Registered
 
Scott at Pelican Parts's Avatar
 
Join Date: Jun 2005
Location: Los Angeles
Posts: 740
Garage
Thanks guys. Mentat, that helped some!
Old 03-28-2008, 11:12 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #12 (permalink)
 
Cars & Coffee Killer
 
legion's Avatar
 
Join Date: Sep 2004
Location: State of Failure
Posts: 32,246
Mentat, it looks like you are using the LUW version of DB2 based on the column names you selected from the catalog.
__________________
Some Porsches long ago...then a wankle...
5 liters of VVT fury now
-Chris

"There is freedom in risk, just as there is oppression in security."
Old 03-28-2008, 11:18 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #13 (permalink)
Registered
 
TheMentat's Avatar
 
Join Date: Dec 2004
Location: Ocean Park, BC
Posts: 2,451
Garage
Quote:
Originally Posted by legion View Post
Mentat, it looks like you are using the LUW version of DB2 based on the column names you selected from the catalog.

you've already lost me!
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant
Old 03-28-2008, 11:46 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #14 (permalink)
Semper drive!
 
rcecale's Avatar
 
Join Date: Mar 2002
Location: Atlanta, GA
Posts: 7,536
Garage
All of you are looking at this from the wrong angle. The correct response is...



Just my own $.02.

Randy

__________________
84 944 - Alpine White
86 Carrera Targa - Guards Red - My Pelican Gallery - (Gone, but never forgotten )
One Marine's View
Igitur qui desiderat pacem, praeparet bellum
Old 03-28-2008, 12:58 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #15 (permalink)
Reply

Thread Tools
Rate This Thread
Rate This Thread:

 


All times are GMT -8. The time now is 06:57 AM.


 
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2025 Pelican Parts, LLC - Posts may be archived for display on the Pelican Parts Website -    DMCA Registered Agent Contact Page
 

DTO Garage Plus vBulletin Plugins by Drive Thru Online, Inc.