Archives de la catégorie SMO – Sql Server Management allows to script Database objects
Publié par hassanboutougha dans SMO - Sql Server Management allows to script Database objects le octobre 6, 2012
With SMO, it is easier to programmatically make same tasks than Sql Server 2008 Management Studio wizard which allows script all database objects (tables, storde procedure, index,data…):
msdn url below will explain you how SMO works
One trooble I have encountered in scripting with smo many tables (many hundred) was that scripting with smo have taken 2 hours against only few minutes with SSMS wizard. One workaround was to firstly use PrefectObject and secondly make call script method with multithreading. It allows me to decrease time processing from 2 hours to 20 minutes.
use PrefetchObject to make one call to load table collection:
Database db = … // get your database root
ScriptingOptions so = new ScriptingOptions();