I am working on project where client asked for the
documentation.
Developers hate documentation, especially when they have
to create it :)
It’s fine if the documentation is about project, but what
if client asked about database documentation?
My mind started to think, is there any way to create this
documentation automatically or with least efforts?
I found three ways which are great to create database
documentation.
1. Database Diagrams
It provides database schema with relationships and
tables-columns details in SQL Server itself as shown below
2. DB>doc
It provides option to generate output report in HTML,
wikiplex or XML format.
Its syntax is sqldbdoc
connection fileName [/y] [/f:value] [/debug]
Parameter details are
·
connection
- connection string of database
·
filename
- output file name
·
[/y]
- overwrite output file
·
[/f:value]
- output format: html, wikiplex, xml (autodetected when omitted)
·
[/debug]
- debug mode (show detailed error messages)
How to use this tool?
1.
Download sqldbdoc.exe
from https://sqldbdoc.codeplex.com/ and
keep it in some folder, for example, D:\Share
2.
Type cmd
in RUN window which open command prompt
3.
Change directory to D:\Share and type
below command with SQL server connection string and output file name
D:\Share>sqldbdoc.exe "Data
Source=.\SqlExpress;user id=sa;password=test@123;DATABASE= Sitecore_WebForms"
Report.htm
4.
You should get below output which indicate
successful report generation
Altairis
DB>doc version 1.0.0.0
Copyright
(c) Altairis, 2011 | www.altairis.cz | SqlDbDoc.codeplex.com
Autodetecting
output format...
Output
format: html
5.
Open “Report.htm” from current directory
i.e. D:\Share. You should get below nicely formatted report as
1. SQL Server Compact & SQLite Toolbox
You can download and install this free Visual
Studio addon SqlCeToolbox.4.5.0.1.vsix from https://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1/
How to use it?
·
Open Visual Studio and click on Tools
-> SQL Server Compact/SQLite Toolbox menu item as
·
Connect to any SQL server database which need
to be documented.
Once connected, you can create database
graph of the tables by selecting option “Create SQL Server Database Graph (DGML)”
as
·
This tool generate DGML file which show all
selected tables with their columns and relationships. You can save this screen
as image by clicking on Copy Image option as shown in the
same screen.
·
You can also save the SQL connection database
as SQL Server Compact file format which save this database in .sdf
file format.
In this format you can do the database documentation
in HTML format by selecting below option
You should get below HTML report
This HTML report is same as DB>Doc tool report.
Internally this Visual studio add on uses DB>Doc utility.
My suggestion is that combine SQL Designer schema image with
this HTML report to create better database documentation.
Also I found that command line utility DB>Doc is more
easy to use for developers.
I hope these steps help you to do the boring documentation
automatically and save your time.
Please leave your comments or share these technics if it’s
useful for you.