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.
- 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).
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
Prize winner in Competition "Best article of May 2008"
Click to see my CodeProject Articles
Share a solution | Explore the .NET world
His Favorite(s) :
nHibernate - The best ORM
nHibernate Contributed Tools