all groups > sql server (alternate) > february 2006 >
You're in the

sql server (alternate)

group:

tools for analysis relations


tools for analysis relations stemond79 NO[at]SPAM gmail.com
2/27/2006 1:29:31 AM
sql server (alternate): Are there tools for SQL2k database that take a database return all
relations of tables.

thanks.
Stefano.
Re: tools for analysis relations DickChristoph
2/27/2006 6:32:15 PM
Hi Stefano

You can use the Enterprise Manager and generate a new diagram, Add all the
tables in the database and it will show the relationships.

Alternatively you can Script Database objects from the Enterprise. Manager.

Select All tables in the Tables node of the database, right click and choose
"All Tasks", "Generate SQL Script"

Include the option "Script Primary Keys, Foreign Keys, defaults and check
constraints" and it will include a couple of lines such as :

ALTER TABLE [dbo].[ShippingQueue] ADD
FOREIGN KEY
(
[BoxID]
) REFERENCES [dbo].[Boxes] (
[BoxID]
)

Which in this case indicates that in the table ShippingQueue, the column
BoxID references the table Boxes, Column BoxID as a foreign key.

--
-Dick Christoph

[quoted text, click to view]

Re: tools for analysis relations stemon79 NO[at]SPAM libero.it
3/1/2006 12:40:03 AM
Hi DickChistoph

if i design a datagram i don't see the relations between tables. WHy?



DickChristoph ha scritto:

[quoted text, click to view]
Re: tools for analysis relations figital
3/1/2006 7:51:17 AM
You need to "Add Related Tables". Tables are only related if you
explicitly create relationships.
Re: tools for analysis relations DickChristoph
3/1/2006 4:24:21 PM
Hi Stefano,

Are you sure the tables are truly related?

For example if I script my ShippingQueue Table as Create in the QA it tells
me that ShippingQueue.BoxID References Boxes.BoxID as shown below.

CREATE TABLE [ShippingQueue] (
[Ord] [int] IDENTITY (1, 1) NOT NULL ,
[BoxID] [int] NOT NULL ,
PRIMARY KEY CLUSTERED
(
[Ord]
) ON [PRIMARY] ,
FOREIGN KEY
(
[BoxID]
) REFERENCES [Boxes] (
[BoxID]
)
) ON [PRIMARY]
GO

--
-Dick Christoph
[quoted text, click to view]

AddThis Social Bookmark Button