Subscribe to Windows IT Pro
October 30, 2008 12:00 AM

SQLScripter

Automate the generation of database schema scripts
SQL Server Pro
InstantDoc ID #100140
Rating: (6)
Executive Summary:

SQLScripter is a free SQL Server tool that you can use to quickly and easily automate the generation of database schema. You can use SQLScripter to perform many tasks, including tracking schema history using an automated job. SQLScripter runs on SQL Server 2005 and requires the Microsoft .NET Framework 2.0.

I’m going to introduce you to a free tool called SQLScripter, a command-line utility that you can use to quickly and easily automate database schema scripting tasks, such as script generation for disaster recovery or as part of the development process for checking in the database schema. The manual process of using the GUI to generate a schema is slow, tedious, and prone to mistakes. SQLScripter addresses all these problems by transforming database schema generation from a slow, manual process into a fast, automated one. SQL Scripter improves on SQL Server Management Studio’s (SSMS’s) Generate SQL Server Scripts Wizard by eliminating the requirement that you have to use the GUI to manually build the exact composition of the objects you want scripted.

Using SQLScripter
SQLScripter was written by Yaniv Etrogi, a SQL Server developer and DBA living in Tel Aviv, Israel. Yaniv wrote the tool while developing a high-availability solution for a replicated environment. The subscriber needed to be up-to-date with the publisher’s work so that in the event of a disaster the subscriber could take on the role of the publisher.

You can run SQLScripter as a SQL Server Agent job step of type “Operating system (CmdExec)” via the Windows Task Scheduler, from a batch file, or by manually executing the utility from the Windows command prompt. You can control the tool via its configuration file, SQLScripter.exe.config, which uses parameters to manage all aspects of the schema script generation. You can configure the utility in a variety of ways. For example, you could configure SQLScripter to be executed on Server1 to script out a set of objects on Server2 and direct the output to a path and file on Server3. SQLScripter’s biggest benefit is that it provides an easy way for you to automate schema script generation from within SSIS jobs.

SQLScripter uses trusted connections when connecting to local and remote servers. Note that you can’t use it to script encrypted database objects. Upon completion, SQLScripter terminates with a return value of 0 on success and 1 on failure.

You can scope the schema script generation by instance, database, and object type. You can also script out server-level objects such as jobs and roles. You must declare on Output Path, where the script file is stored as a local path, mapped drive, network drive, or by its Universal Naming Convention name. Of course, the account executing SQLScripter must have permission to create folders and files at Output Path. To script objects, the user must have SELECT permissions or otherwise be able to “see” the object to be scripted. You can use a .zip file to store the schema generation script that’s created and specify a password for the .zip file to secure it.

SQLScripter

Benefits: You can use SQLScripter to quickly and easily automate database schema scripting tasks.

System Requirements and Notes: SQL Server 2005; Windows Vista, Windows XP, or Windows Server 2000 and later; the Microsoft .NET Framework 2.0

How to Get It: You can download SQLScripter from www.sqlserverutilities.com/download.htm.

You can use SQLScripter to perform many different tasks, including

• migrating a database schema between production, quality assurance, and development environments

• keeping the latest schema in source control • tracking schema history regularly using an automated job

• creating a script quickly and easily to drop and create all indexes for fill factor maintenance and defragmentation

• scripting out important server-level objects before the installation of an upgrade, service pack, or hotfix to ensure the recoverability of jobs and extended stored procedures

System Configurations
SQLScripter was developed using SQL Server 2005 and uses the Microsoft .NET Framework 2.0, including SQL Server Management Objects. It runs on Windows Vista, Windows XP, and Windows Server 2000 and later. It was tested primarily on SQL Server 2005 in 32-bit environments, but it might work (unsupported) in 64-bit environments.

Related Content:

ARTICLE TOOLS

Comments
  • KEVIN
    3 years ago
    Nov 01, 2009

    Please note that the URL shown above is out of date and will produce a 404 error. To download SQL Script, please use:

    http://www.sqlserverutilities.com/SQL-Server-Utilities-SQLScripter-product-details.htm

    Thanks,

    -Kevin

  • Yaniv
    4 years ago
    Dec 03, 2008

    Hi,
    A new version of SQLScripter is now available for download.

    This version only resolves the bug encountered with the zipping and due to the many requests by users, it also offers the capability of deleting or not the unzipped original folder in case the zip completes with success.

    http://www.valinor.co.il/tools-sqlscripter.asp

    -Yaniv

  • Yaniv
    4 years ago
    Nov 19, 2008

    Guys, sorry for the confusion. The link published in the article takes you to a page where you need to scroll down all the way in order to see the actuall download link. This is the direct download link:
    http://www.valinor.co.il/sqlscripter/SQLScripter.zip

    SQLScripter by Yaniv Etrogi is free as stated in it's attached License Agreement.

    -Yaniv

  • meganbearly
    4 years ago
    Nov 13, 2008

    Hi jmgibson,
    Have you been able to download SQLScripter for free from the link above? I just tested the Click Here to Download SQLScripter link at http://www.valinor.co.il/sqlscripter/sqlscripter.html and was able to download the .zip file and get to the installation wizard with no problems. Please let me know if you are still having problems downloading the tool.
    Thanks,

    Megan Keller
    Associate Editor, SQL Server Magazine
    mkeller@sqlmag.com

  • Jeff
    4 years ago
    Nov 11, 2008

    I've emailed the contact to see if they can fix the .zip file on the provided link.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.