Some time ago I was looking for a “quick and dirty” way of generating HTML documentation of one of my clients’ database schema. I didn’t need an ER diagram – just a list of tables to insert into a word document. At that time TOAD for DB2 did not exist, so I could not use it for my purpose.
Eventually, I ended up creating a simple solution for that simple problem, using a SQL script fetching information from the database catalog and an XSL template to transform its output into HTML, similar to this.
tbldoc is just a bunch of SQL scripts, XSD and XSL files, and a sample CSS style sheet that all serve a single purpose: to create simple documents describing tables and views in a database.
The information that is extracted from a database system catalog contains description of each column of each (specified) table and view. That information is saved as an XML document that conforms to the provided schema. An XSL transformation can then be applied to that XML in order to produce an HTML representation of the catalog data.
Internet Explorer and Firefox can perform transformation of XML documents “on the fly”, so opening XML file in one of those browsers presents a nicely formatted database catalog. Here is a sample.
The HTML file can be viewed online, copied and pasted into a word processing program, or opened directly by such program (e.g. Microsoft Word).
Database system catalog contents differ from vendor to vendor and from
version to version. For this reason the SQL query used to extract catalog
information would be different in each case. For now I only have a script for DB2 UDB v8.
If you think it can be useful for you please download the archive and freely use the tool.