Generate table relationship diagram from existing schema (SQL Server) [closed]
Asked Answered
P

9

204

Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database?

This is for SQL Server 2008 Express Edition.

Predictory answered 3/10, 2008 at 20:23 Comment(2)
a free tool named SchemaSpy can do that like charm. But, needs a little setup. I have detailed the step here: blog.kmonsoor.com/generate-er-diagram-from-sql-databaseCommonable
nice one: 60 DB Reverse engineering tools (see filter on the left) - dbmstools.com/categories/database-diagram-tools/sqlserverHildagarde
M
162

Yes you can use SQL Server 2008 itself but you need to install SQL Server Management Studio Express (if not installed ) . Just right Click on Database Diagrams and create new diagram. Select the exisiting tables and if you have specified the references in your tables properly. You will be able to see the complete diagram of selected tables. For further reference see Getting started with SQL Server database diagrams

Materiality answered 3/10, 2008 at 20:23 Comment(2)
Any way to do this with SQL Server Compact 3.5?Inexpressible
One should be able to see all the existing relationships as well once you add all the necessary tables.Saturation
C
56

Try DBVis - download at https://www.dbvis.com/download - there is a pro version (not needed) and a open version that should suffice.

All you have to do is to get the right JDBC - database driver for SQL Server, the tool shows tables and references orthogonal, hierarchical, in a circle ;-) etc. just by pressing one single button. I use the free version for years now.

Cosmotron answered 3/10, 2008 at 20:30 Comment(5)
This was very easy to set up, and produced a much more readable diagram than the SQL Server tools do. +1Paleozoic
Very easy to set up iff you're already running JDBC. Otherwise potentially in all to familiar config heck.Retention
Works nicely if you have proper foreign key relationships.Dissonancy
In addition to this answer; if you face connection problem check this dba.stackexchange.com/questions/62165/… the. The other JDBC info dbvis.com/features/sqlserver-database-drivers and for updated JDBC driver look at this microsoft.com/en-us/download/details.aspx?id=57175Gasconade
When specifying the Database port, I used the Dynamic Port of the sql server instead. The regular port 1433 does not work for me.Marylnmarylou
B
13

SQLDeveloper can do this.

http://sqldeveloper.solyp.com/

Botany answered 5/10, 2008 at 1:53 Comment(1)
This link now redirects to the home page: solyp.com. Seems deprecated.Keg
C
8

For SQL statements you can try reverse snowflakes. You can join at sourceforge or the demo site at http://snowflakejoins.com/.

Cate answered 7/5, 2011 at 21:10 Comment(1)
Doesn't do the task (visualizing the database schema) but is still pretty cool though. I wish there were something like this to generate a tidy diagram of a computer network from a textual description...Kiker
I
4

Why don't you just use the database diagram functionality built into SQL Server?

Imprimatur answered 3/10, 2008 at 20:24 Comment(2)
It is not always available.. some versions of SSMS and SQL do not allow of due to licensing.Cardona
Or you can, you know be on GNU/LInux or Macos actually without any license, just with connection credentials.Chinese
G
2

Visio Professional has a database reverse-engineering feature if yiu create a database diagram. It's not free but is fairly ubiquitous in most companies and should be fairly easy to get.

Note that Visio 2003 does not play nicely with SQL2005 or SQL2008 for reverse engineering - you will need to get 2007.

Gosse answered 3/10, 2008 at 20:36 Comment(1)
This feature has unfortunately been removed in Visio 2013.Formaldehyde
S
2

DeZign for Databases should be able to do this just fine.

Squiffy answered 11/1, 2012 at 11:48 Comment(0)
T
1

SchemaCrawler for SQL Server can generate database diagrams, with the help of GraphViz. Foreign key relationships are displayed (and can even be inferred, using naming conventions), and tables and columns can be excluded using regular expressions.

Thyme answered 11/5, 2010 at 2:43 Comment(2)
"Foreign key relationships are inferred, using naming conventions" - totally inapplicable for in the most of real business cases.Kiker
You'd be surprised how often this is needed.Dissonancy
C
0

MySQL WorkBench is free software and is developed by Oracle, you can import an SQL File or specify a database and it will generate an SQL Diagram which you can move around to make it more visually appealing. It runs on GNU/Linux and Windows and it's free and has a professional look..

Counterpoison answered 23/3, 2013 at 12:55 Comment(3)
It doesn't seem to support DBMSes other than MySQL any more. Also, its diagram auto-layout is dreadful.Kiker
the auto layout simply stacks everything on top of another, you must then drag each table to the appropriate position, it might be dreadful but I doubt any algorithm would be smart enough to order everything neatly. As for SQL support I use it with H2 server queries and it works, I think they support most SQL-92 compliant SQL so if your code doesn't comply to SQL-92 it might be a good occasion to check it.Counterpoison
The incompatibilities lie everywhere from very basic things like quotes/brackets usage to huge differences in DDL (tables/keys/constraints/indices definition language) and fundamental differences in types (like using a separate type for Unicode strings).Kiker

© 2022 - 2024 — McMap. All rights reserved.