You wouldn't code without comments, so why database without them?
Databases can be complex, disastrous things. Not every database admin, developer, or analyst has the time to learn the ins and outs of a database in order to just do their work. To make things worse, few products and fewer free options exist to help present databases in a human readable format.
sp_doc's goal is to generate on the fly database documentation in
markdown. This means you now have a free and extensible
selfdocumenting database! By building the tool in TSQL, the documenting
process can remain simple, secure, require no additional infrastructure, and avoid
red tape that third party applications often require.
and plays nice with:
Target database to generate documentation for. If not supplied, the current database is used.
Name of the extended property containing descriptive text for objects. The default value is "Description".
The primary parameter for this procedure is a database name, since the primary scenario for this is to be included in a utility or system database:
> EXEC dbo.sp_doc @DatabaseName = 'WideWorldImporters'
An alternative key for extended property values can also be specified to
override the default of
> EXEC dbo.sp_doc @DatabaseName = 'WideWorldImporters', @ExtendedPropertyName = 'MS_Description';
To prevent data truncation, unwanted headers, etc. it should be called via sqlcmd, outputting directly to a readme.md file:
sqlcmd *S localhost *d master *Q "exec sp_doc @DatabaseName = 'WideWorldImporters';" *o readme.md *y 0
Output for the WideWorldImporters database.
Note: Slight changes may be made to this database to better demo script capabilities.
Missing a feature? Found a bug? Open an issue to get some .
Check out the other scripts in the Express SQL Suite.