Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Script SQL Server DDL

By Richard Sutherland, 2007/08/20

Scripting SQL Server DDL
Richard Sutherland

If you buy into the theory that all database objects should be contained in a source management system such as Visual SourceSafe, and that deployment of database projects should be done from the source management system, then the manner in which Microsoft's Visual Studio 2005 Team Edition for Database Professionals [a.k.a., the "Data Dude"] should be of interest to you. It provides a tool which, among other things, will script out every object in a database to individual files -- something SQL Server Management Studio is incapable of performing. These files can then be checked into source management, and from that point forward all database development would be done in a normal development check-out/modify/check-in fashion to which many application developers are accustomed.

The Data Dude contains many features beyond scripting, but if you are just seeking a way to script out databases, and if you consider the expense the Data Dude for this process to be extreme, then a free open source project may be your answer. A “Script SQL Database DDL” tool can be found at: http://sourceforge.net/projects/script-sql-db. It contains a downloadable version of ScriptDB.exe, as well as the source code used to develop it in a Visual Studio project.

This tool scripts out entire databases into a directory tree which mimics the structure produced by the Data Dude. It produces a separate file for every object. In the case of tables, its triggers, indexes, constraints and keys each get there own file [just as the Data Dude does]. This differs from SQL Server Management Studio which, when scripting a table, includes all of these objects in the same file as the CREATE TABLE statement -- and this makes it difficult to use such a file in a source management system.

Tables are the oddball item when it comes to using a source management system, but if they are handled as individual components it makes much more sen

Total article views: 1240 | Views in the last 30 days: 6
 
Related Articles
FORUM

Is there integration of TFS 2008 source control with SQL Server 2008 Management Studio / Client tools for Database versioning???

Descriptive Tags: TFS 2008 source control , SQL Server 2008 Management Studio, SQL Server 2008 Clien...

BLOG

Managing Schemas And Source Control For Databases

Visual Studio has a project type called “Database Project” that is used to manage a database schema ...

ARTICLE

Manage Multiple SQL Server Installations and Databases with OSQL

This article explains how to use a simple batch file and script file to manage multiple databases on...

ARTICLE

Open Source SQL DDL Scripting Tool

Keeping track of your DDL is something that is critical and some sort of VCS system should be used. ...

FORUM

How to manage with the disabled/Non existing Source Data

manage with the disabled/Non existing Source Data

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones