Archives de la catégorie SMO – Sql Server Management allows to script Database objects

latency using SMO to script Table – Sql Server Management Object

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();

db.PrefetchObject(typeof(Table), so);


Poster un commentaire

Microsoft System Center 2012

All System Center 2012 products, Service Manager, App-Controller, Orchestrator, Virtual Machine Manager, Configuration Manager, Data Protection Manager, Operation Manager -Boutougha Hassan

Microsoft Windows Server 2012

IT - Windows server 2012 - Hassan Boutougha

Microsoft Hyper-V

IT - Hyper-V - Hassan Boutougha

Microsoft SQL Server 2012

IT - SQL Server 2012 - Hassan Boutougha