SQL: ScriptDb 2.0

Published by Marian Galie-Andriescu on

ScriptDb is a C# console app that uses SQL Management Objects (SMO) to script database objects.

This project is a refinement and improvement of the orignal work of  Jesse Hersch of http://www.elsasoft.org

His project can be found at codeplex:


Some other forks of the same project can be found here:



My version has the following improvements:

Compiled for SQL Server 2008 & 2012
Implemented support for including schemas when scripting foreign keys.
Fixed order of exporting sql objects taking into account the dependencies therefore the sql script can be used to recreate the original database.
Added a lot more command line options to control what kind of database objects are scripted.
Can script all user databases to one file or their own files.
Added options to control the sql version the output scripts are compatible with.
Do not use DateLastModified if database is in sql2000 compatibility mode because it is not supported.
Fixed exported file names so only allowed characters and words are used.
Update solution for Visual Studio 2013.
Show info about the sql server version we are exporting from.
Bug fixes.

Command Line documentation:

Andriescu SQL ScriptDb 2.0 CommandLine Documentation

The whole project including source code, documentation, release notes, and binaries can be downloaded here:

Andriescu SQL ScriptDb 2.0

Categories: SQL