Somehow I missed this gem that’s been around for quite a while so I thought I would share it in case anyone else has yet to see it. The Forward Engineer add-in is a really great open source project that allows Visio database diagrams you create to easily be converted to T-SQL that will create physical objects in a SQL Server database for you.
If you’ve ever used Visio for visualizing existing databases into a diagram then you’ve likely used the standard Reverse Engineer option. The idea with the Forward Engineer add-in is exactly the opposite. Meaning it will create database object (script them out) from a Visio design.
This functionality previously existed in Visio 2003, if you had the Enterprise Architect version. Unfortunately, the feature was stripped out of the product after 2003 and Alberto Ferrari started this project to fill the gap. He’s stopped development on the project several years ago but you’ll still find the open source project available here http://forwardengineer.codeplex.com/.
When you download the tool you may have issues installing it like I did, but if you read the discussion page on the codeplex site it should guide you on how to maneuver around the problems. The project does not appear to be actively getting updated so there are a few things like this to deal with but it’s worth it!
After installing you get a new tab in the Office ribbon in Visio that’s fairly basic. The first button in the tab, Validate Data Model, will validate the data model before you create your script. The second button, Forward Engineer, does the real work and will generate a .sql file that will create all the objects in your Visio diagram for your SQL Server database.
One of the things I was really hoping this tool could help me with is adding Extended Properties to each of my columns to make the database self-documenting but unfortunately it does not easily have the capabilities of doing that. Alberto did write on a solution to show how this is possible but I’ve yet to get it to work for me. http://sqlblog.com/blogs/alberto_ferrari/archive/2007/11/07/visio-and-sql-extended-properties-a-tool-to-marry-them.aspx
I’ve start using this regularly now and It’s been a lifesaver to not only create documentation of my databases in Visio but then script out database objects.