Sometimes there’s a need to create database documentation – an old fashioned list of tables, columns, views etc. – as part of delivering a project, or for analysts, project managers and end users.
In these situations I tend to automate. SQL Server is very “meta” in that it contains tables and records that describe, well, other tables and records. Coupled with the
MS_Descriptionextended property, it’s a powerful way to keep up-to-date documentation in close proximity to the code itself.
The script below will generate Markdown for database tables, views, stored procedures and functions. Column names and data types are listed for tables. View definitions are output. For stored procedures and functions, only the
MS_Descriptionextended property will be output.
Click through for a big disclaimer and a bigger script.