Click here to Skip to main content
15,867,686 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

 
PraiseGreat script Pin
Md. Ismail7-Jun-17 19:20
Md. Ismail7-Jun-17 19:20 
PraiseThis is great - minor fix Pin
Robert Jurado18-May-17 6:44
Robert Jurado18-May-17 6:44 
GeneralMy vote of 5 Pin
thaidx8-Apr-13 18:18
thaidx8-Apr-13 18:18 
GeneralMy vote of 5 Pin
BerBuz2-Dec-12 3:44
BerBuz2-Dec-12 3:44 
GeneralMy vote of 5 Pin
bigfiveai.com10-May-12 9:07
bigfiveai.com10-May-12 9:07 
GeneralMy vote of 5 Pin
G.Suman Babu20-Apr-12 4:06
G.Suman Babu20-Apr-12 4:06 
QuestionVery good Article Pin
G.Suman Babu20-Apr-12 4:05
G.Suman Babu20-Apr-12 4:05 
QuestionExcellent script Pin
mickegus9-Feb-12 20:35
mickegus9-Feb-12 20:35 
QuestionGreat job! Pin
PiotrZajac5-Feb-12 8:08
PiotrZajac5-Feb-12 8:08 
GeneralMy vote of 5 Pin
Cassnat14-Dec-11 12:28
Cassnat14-Dec-11 12:28 
QuestionFlippin Cool! Pin
StewStyle12-Dec-11 23:06
StewStyle12-Dec-11 23:06 
GeneralMy vote of 5 Pin
Bastiaans1-Jun-11 0:17
Bastiaans1-Jun-11 0:17 
General[My vote of 1] Thanks Pin
Mamun Reza30-May-11 18:44
Mamun Reza30-May-11 18:44 
GeneralThanks! Pin
bougie4-May-11 3:45
bougie4-May-11 3:45 
GeneralMy vote of 5 Pin
kiran.puchakayala22-Apr-11 18:18
kiran.puchakayala22-Apr-11 18:18 
GeneralThank you!! Pin
Priya666611-Feb-11 5:39
Priya666611-Feb-11 5:39 
GeneralThank you Pin
samirMistry18-Oct-10 20:39
samirMistry18-Oct-10 20:39 
GeneralThank you very much! .good job Pin
koke171-Oct-10 0:40
koke171-Oct-10 0:40 
GeneralVery good work (PERFECT!!!) Pin
Albric2-Sep-10 23:47
Albric2-Sep-10 23:47 
GeneralMy vote of 5 Pin
aivanq012-Sep-10 5:31
aivanq012-Sep-10 5:31 
GeneralAwesome script Pin
aivanq012-Sep-10 5:30
aivanq012-Sep-10 5:30 
Thanks a lot for your effort, this an excelent time saver. Thumbs Up | :thumbsup:
GeneralMy vote of 4 Pin
NArgade22-Aug-10 23:53
NArgade22-Aug-10 23:53 
GeneralThank You Pin
silverscouts9-Apr-10 15:24
silverscouts9-Apr-10 15:24 
GeneralExcelent time saver [modified] Pin
adesilva@bigw.com.au17-Feb-10 10:58
adesilva@bigw.com.au17-Feb-10 10:58 
GeneralAwesome! Just what I was looking for! Thanks! Pin
miguelguzman16-Feb-10 4:07
professionalmiguelguzman16-Feb-10 4:07 

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.