Tuesday, July 7, 2009

Generating SQL Diagrams using MS Visio 2003

You can build a set of database diagrams using Visio 2003 SP1.  It’s not the best solution but it does work to some extent.  Like all reverse engineering tools it assumes that you have implement some form of relationship mapping and constraints in within the database.

1) Open Visio and Select “Database/Database Model Diagram”

image

2) From the menu choose Database / Reverse Engineer

image

3) Set up your connection to the database

image

choose SQL Server / click New.

image

Select System Data Source and click Next.

image

Select SQL Server and click Next and Finish

image

Enter a meaningful name and enter the DB Server you want to work against (in this case Dubwsdev001), click Next and Next again to use Network Authentication.

image

Select your database and click Next and Finish and then OK.  Click Next at the Reverse Engineering Wizard dialogue.

image

Select the times you want to reverse engineer and click Next.

image

Select the Tables/Views you want to work with and click Finish.

image

You should now see the table in your Visio page. 

Remember that this reflects the table structure exactly, so if there are lots of columns, you’ll see lots of columns.  After a few hours playing around you’ll probably find doing it by hand is easier.

Alternative Solution

You can also use SQL 2005 or 2008 Management Studio to create database diagrams, however we don’t have a copy of that here.