Click here to Skip to main content
15,867,453 members
Articles / Database Development / SQL Server

Document SQL Server 2000/2005 Database

Rate me:
Please Sign up or sign in to vote.
4.83/5 (103 votes)
17 Oct 2009CPOL1 min read 240K   27.2K   113   81
T-SQL script to generate the document of SQL 2000/2005 database

Introduction

Here is the script to generate the HTML document of your SQL Server 2000/2005 database. It is reverse engineering after the database is created. I hope it will be useful to many of you.

Background

While working as a part time DBA for some projects, I encountered difficulties in documenting and publishing my databases because I do not have any tool available to generate the document. I have written this script that gives the output in HTML that is easy to be modified/published/distributed.

Using the Code

Follow these steps to use this script:

  • Download the attached script file and open it in Management Studio (tested on version 9.00).
  • Select the database for which you want to generate document.
  • Select Result to File (Ctrl+Shift+F) from Query - Results To menu.
  • Execute (F5) the script.
  • In the Save Result dialogue box, type a file name (filename.htm/filename.html) in the File Name text box and select All Files (*.*) in Save As Type dropdown.
  • After successful execution of query, check the output file.

Note: For populating the description of table and columns, update the Description property of table and columns while creating database diagram or add extended property for them with name as MS_Description.

I hope this information will be helpful. I am planning to provide details of code in my next update.

Updates

  • Bug in getting index column is resolved
  • Bug in getting check constraints list is resolved
  • Definition of check constraints is added to document
  • Table Summary is changed to Table Description
  • Table and column description is populated from extended property

Download documentation application from here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Database Developer
United Kingdom United Kingdom
With 10 years of experience of working on Microsoft platform, currently I am working as Database/BI expert.

Comments and Discussions

 
GeneralWow, thanks Pin
Thomas Wells4-Mar-08 6:20
Thomas Wells4-Mar-08 6:20 
GeneralComming up with newer versions... Pin
virtualleye28-Feb-08 17:49
virtualleye28-Feb-08 17:49 
GeneralAmazing Work. Pin
Dipak V Bava28-Feb-08 17:25
Dipak V Bava28-Feb-08 17:25 
GeneralRe: Amazing Work. Pin
Nitinpatel28-Feb-08 22:07
Nitinpatel28-Feb-08 22:07 
GeneralRe: Amazing Work. Pin
Dipak V Bava6-Mar-09 4:34
Dipak V Bava6-Mar-09 4:34 
Generalthanx Pin
KINGCHEMICAL25-Feb-08 18:30
KINGCHEMICAL25-Feb-08 18:30 
GeneralAdd like from fk column to referenced table Pin
gilad12325-Feb-08 0:44
gilad12325-Feb-08 0:44 
GeneralNice Script Pin
esolomonidis18-Feb-08 8:58
esolomonidis18-Feb-08 8:58 
GeneralExcellent work! Pin
sys2matk18-Feb-08 7:28
sys2matk18-Feb-08 7:28 
GeneralCool Quesry!!!! Pin
alex_kl18-Feb-08 5:58
alex_kl18-Feb-08 5:58 
GeneralGreat! But... Pin
PKV113-Feb-08 1:22
PKV113-Feb-08 1:22 
GeneralRe: Great! But... Pin
Nitinpatel17-Feb-08 22:55
Nitinpatel17-Feb-08 22:55 
QuestionWhere is the Description? Pin
IamHanson12-Feb-08 15:22
IamHanson12-Feb-08 15:22 
AnswerRe: Where is the Description? Pin
Nitinpatel18-Feb-08 2:28
Nitinpatel18-Feb-08 2:28 
GeneralExcellent work Pin
SleepyCrat12-Feb-08 3:33
SleepyCrat12-Feb-08 3:33 
GeneralRe: Excellent work Pin
Nitinpatel18-Feb-08 2:29
Nitinpatel18-Feb-08 2:29 
GeneralVery useful Pin
Vikas Mehta12-Feb-08 3:13
Vikas Mehta12-Feb-08 3:13 
GeneralVery good indeed Pin
crchambers144212-Feb-08 1:23
crchambers144212-Feb-08 1:23 
GeneralRe: Very good indeed Pin
Nitinpatel17-Feb-08 21:52
Nitinpatel17-Feb-08 21:52 
GeneralRe: Very good indeed Pin
rjf6061817-Jul-08 5:06
rjf6061817-Jul-08 5:06 
QuestionExcellent script thanks! Pin
PKBoone12-Feb-08 0:47
PKBoone12-Feb-08 0:47 
GeneralRe: Excellent script thanks! Pin
Nitinpatel17-Feb-08 21:51
Nitinpatel17-Feb-08 21:51 
GeneralRe: Excellent script thanks! Pin
PKBoone17-Feb-08 22:10
PKBoone17-Feb-08 22:10 
GeneralRe: Excellent script thanks! Pin
Nitinpatel17-Feb-08 23:32
Nitinpatel17-Feb-08 23:32 
GeneralI like it Pin
don!marco11-Feb-08 21:51
don!marco11-Feb-08 21:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.