Toad World® Forums

Database Diagram Not Drawing Foreign Key Relations


#1

Hi,

I must be doing something foolish, but I can’t figure out where I’m going wrong. Ordinarily, I rely on Database Diagram to visually map the FK relationships between tables. But recently I was experimenting with SQL Server’s treatment of cascading FKs with a simple example, and Toad didn’t draw any arrows at all.

Here is the code. When I try to drag table1 to Database Diagram, it automatically pulls in table2 but does not draw the FK arrow between table2.lastModifiedBy and table1.user_ID:


CREATE TABLE table1

(

user_ID INTEGER NOT NULL PRIMARY KEY,

user_name **CHAR** (**50**) NOT NULL

)

GO

CREATE TABLE table2

(

author_ID **INTEGER** NOT NULL PRIMARY **KEY**,

author_name **CHAR** (**50**) NOT NULL,

lastModifiedBy **INTEGER** NOT NULL,

addedby **INTEGER** NOT NULL

)

GO

ALTER TABLE table2 ADD CONSTRAINT fk_one FOREIGN KEY (lastModifiedBy)

REFERENCES table1 (user_ID) ON DELETE CASCADE ON UPDATE CASCADE

GO


#2

Hi,

Thanks for your post, however could I ask you to repost this question in the product forum please?

As the note at the top of the page says “This forum is for non-product questions and discussions on the SQL Server database platform.”

You can find the product forum at this URL: www.toadworld.com/.../14.aspx

Many thanks,

Rich


#3

So sorry! I saw “SQL Server Community” and assumed it was for the product. Very subtle difference with “Toad for SQL Server Community” if you ask me!

I have re-posted this to the latter forum now. Please feel free to drop this thread.

  • KJ