Click here to Skip to main content
15,124,646 members
Articles / Desktop Programming / Windows Forms
Posted 20 May 2008


43 bookmarked

Schema Generator

Rate me:
Please Sign up or sign in to vote.
4.80/5 (12 votes)
3 Jun 2008Ms-PL2 min read
Utility to generate schema description from existing SQL Server databases.


In this article, I am introducing a small utility developed for the purpose of extracting schema from existing SQL Server databases. The basic idea behind developing this utility is to emit the database schema from an existing SQL Server database. From a developer perspective, it is sometimes very much handy to quickly take a printout of the database structure for creating the UI layout or to specify some validation rules. If the database structure is available in printable format, then it will serve the purpose of robust programming and effective UI layout, because the developer can establish spontaneity between the database structure and the UI elements. So now, let's start exploring the utility in a little depth.

After extracting the binary distribution, you will find the executable SchemaGenerator.exe. Start the utility from SchemaGenerator.exe.

The first screen will be as follows:


The screen shown above asks the input for:

  • Server/instance name: This will be server\instance name. If not specified, it will default to (local).
  • Database name: This is a required input and must specify an existing database.
  • Username/Password: Optional, provide in case of non trusted connections.

Now, fill the server/instance name, i.e., (local)\SQLEXPRESS.


Click Generate to produce the report in printable format. The report will be rendered in preview, where we can see the generated schema output, then print, if required.

The print preview window outputs the database structure in printable format, and you can review the format and print it.


I hope this will help some needful developer and avoid duplication of efforts.

“Happy computing!”


  • Initial revision 1.0 - May 20 2008
  • Uploaded initial revision.

  • Revision 1.1 - June 04 2008
  • Updated for a new feature for using explicit username and password, in non trusted environments (requested by users).

  • Revision 1.2 - June 05 2008
  • Fixed the issue of printing reports from the Print Preview dialog (requested by users).


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

Ashutosh Phoujdar
Architect Oracle
Canada Canada
Ashutosh is an avid programmer, who “lives to code”. One can always find him busy seeking challenging programming assignments on various complex problems ranging from Data management, Classification, Optimization, Security, Network analysis, Distributed computing.

He started his programming stint with “C”; he has also worked on C++, Visual Basic, JAVA, Perl, FoxPro, PASCAL, Shell Scripting, and Perl. Currently, he is proficient and working on C#.

His area of interest includes Distributed Computing, Analytic and Business Intelligence, Large Enterprise System Architectures, Enterprise Content Management.

He is an advocate of Open source and likes to share solutions with open source communities like
1.Stack Overflow
2. nHibernate

Award's :
Prize winner in Competition "Best article of May 2008"

Articles :
Click to see my CodeProject Articles

Blog :
Share a solution | Explore the .NET world

Link'd :

His Favorite(s) :
nHibernate - The best ORM.
nHibernate Contributed Tools

Comments and Discussions

GeneralMy vote of 5 Pin
Kanasz Robert25-Sep-12 23:46
professionalKanasz Robert25-Sep-12 23:46 
Generalok article Pin
Donsw21-Feb-09 8:56
MemberDonsw21-Feb-09 8:56 
GeneralRe: ok article Pin
Ashutosh Phoujdar22-Feb-09 20:06
MemberAshutosh Phoujdar22-Feb-09 20:06 
Much appreciated. I will include details on the difficulties during implementation Smile | :)

GeneralPrint only one blank page Pin
Edward1114-Jun-08 7:43
MemberEdward1114-Jun-08 7:43 
GeneralRe: Print only one blank page Pin
Ashutosh Phoujdar5-Jun-08 2:40
MemberAshutosh Phoujdar5-Jun-08 2:40 
GeneralRe: Print only one blank page Pin
Ashutosh Phoujdar5-Jun-08 4:30
MemberAshutosh Phoujdar5-Jun-08 4:30 
GeneralRe: Print only one blank page Pin
Edward1115-Jun-08 13:40
MemberEdward1115-Jun-08 13:40 
GeneralRe: Print only one blank page Pin
Ashutosh Phoujdar5-Jun-08 23:50
MemberAshutosh Phoujdar5-Jun-08 23:50 
QuestionWith 'sa' password? Pin
pvatanpour27-May-08 20:59
Memberpvatanpour27-May-08 20:59 
AnswerRe: With 'sa' password? Pin
Ashutosh Phoujdar30-May-08 4:30
MemberAshutosh Phoujdar30-May-08 4:30 
AnswerRe: With 'sa' password? Pin
Ashutosh Phoujdar3-Jun-08 23:18
MemberAshutosh Phoujdar3-Jun-08 23:18 
GeneralAwsome! Pin
pvatanpour5-Jun-08 11:06
Memberpvatanpour5-Jun-08 11:06 
GeneralMS Visio Pin
Gautam Sharma25-May-08 23:21
MemberGautam Sharma25-May-08 23:21 
General[Message Removed] Pin
Mojtaba Vali25-May-08 1:54
MemberMojtaba Vali25-May-08 1:54 
GeneralVery nice, simple and useful for a trusted connection. Pin
Buddy Stein20-May-08 7:33
MemberBuddy Stein20-May-08 7:33 
GeneralNeed correction before approve Pin
Abhijit Jana20-May-08 3:03
professionalAbhijit Jana20-May-08 3:03 
GeneralRe: Need correction before approve Pin
Ashutosh Phoujdar20-May-08 6:41
MemberAshutosh Phoujdar20-May-08 6:41 
GeneralRe: Need correction before approve Pin
Abhijit Jana20-May-08 20:18
professionalAbhijit Jana20-May-08 20:18 

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.