Printing SQL Server Database Schema

I’ve been working with SQL Server 2000 for about 2 months now, and it completely frustrates me that I cannot print table schema from Microsoft’s Enterprise Manager. I’m one of those people who like to have printouts of the table’s I’m working with as it makes it easier for me to generate my SQL statements.

Doing some searching on Google, I found a couple of tools that will print schema, but they wanted at least $59US! So I decided to write my own script and offer it up for free.

The script uses ASP classic, so it will need to run on an IIS server. You will need to modify the script and specify data source/ip address of your SQL Server, choose an Initial Catalog/Database”, and supply a *username and password. When you first run the script in your web browser, you will see a navigation bar along the left side of the page that lists the tables for your selected database. When you click on a table name, the schema for that table will appear. The action of clicking on a table name invokes an xmlhttprequest object to display the table schema. This means that the table list is not being regenerated with each request. It also means that you can click on multiple tables to stack them up! To remove a table from the display, simple click on the table name and it is removed from the DOM.

The Hide Table List link that appears above the list of tables is simply there to hide the table navigation bar when you want to print your table schema. Once you hide the list, you must refresh the browser to bring it back.

So, here is the file. Help yourself and I look forward to any feedback!