Wednesday, March 21, 2012

DB schema report/documentation - not diagram

Is there any way to generate something like a word document to report the schema of a database? Not a diagram, but a narrative report with TOC and everything. And without buying additional DB Documentation tools. Thanks.

Dad, don't think there's anything built-in reporting at the level you are looking for. You can attach comments to tables or columns... with this command... sp_addextendedproperty and then join to that comment with this ::fn_listextendedproperty something like this...

SELECT * FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 't_tablename', 'column', default)

You could join that function to the regular information_schema.columns view and get a list of all columns and their comments...

If you have Erwin available, it prints nicer reports, with schema images, TOC, and all that... but for a straight list that you could export to a Word Doc, and build a TOC there, it's not too bad... If you have a Dictionary already, you could push those defs into the column comments, they are then viewable on the table design screens also...

Bruce

No comments:

Post a Comment