SMOscript: Scripting database objects using SMO

I created SMOscript a couple of months ago with the intention to make it a replacement for the SQL Server 2000 tool called scptxfr.

After installing SQL Server 2008 and AdventureWorks, I found that, besides some other shortcomings, SMOscript would not connect to an SQL Server 2008. Clearly time for an update!

The new version of SMOscript provides these improvements and new features:

The database dictionary is iterated faster by calling SetDefaultInitFields.

CREATE scripts now include child objects such as constraints and triggers as a result of SetDefaultInitFields.

SMOscript scripts all scriptable database objects as defined by SMO API. (The previous version only scripted tables, views, synonyms, stored procedures, and functions)

SMOscript now supports SQL Server 2008.

The latest version of SMOscript is available for download here.

Note: This is a command-line tool. You won’t see an icon under Start/Programs!

3 thoughts on “SMOscript: Scripting database objects using SMO

  1. Pingback: Synching SQL Server Databases « devioblog

  2. Thanks for sharing your great program. I am having a problem on SQL 2008. When it encounters an encrypted stored procedure or access block on an object it stops processing the rest of the objects. The drop flag will find all the objects to drop but the create will not include objects after the error.

    “Error iterating objects: Script failed for StoredProcedure ‘’.

    Is there a way to make the program continue even if there is an error like scptxfr can.

    From scptxfr help:
    /E – Stop scripting when error occurs.
    Default behavior is to log the error, and continue.


  3. Pingback: Scripting all MS SQL Databases using SMOscript « devioblog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.