THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Linchi Shea

Checking out SQL Server via empirical data points

Performance impact: Speeding up SMO script generation – the test code

The attached is the C# code that I used for generating the test results charted in my previous post.


Note that for testing no generated script is actually persisted into a file by this program. The Script() method is applied, but the resulting script strings are thrown away. For example, here is how a stored procedure is scripted:


StringCollection sc = db.StoredProcedures.ItemById(objectId).Script();

foreach (string s in sc)

  { };


You can run the compiled program as follows:


cmd>smpScript.exe <server name> <database name> <number of threads>

Published Tuesday, December 15, 2009 3:10 PM by Linchi Shea
Filed under: , ,


Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



ALZDBA said:

Thank you for your test code!

Also keep in mind that providing the correct script parameters for the object to are scripting, will vastly speed up its processing !

December 16, 2009 2:23 AM

Leave a Comment


About Linchi Shea

Checking out SQL Server via empirical data points

This Blog


Privacy Statement