Hi All,
I’ve been using SMO heavily in
my OSR data migration piece of work, and I’d like to share that with you.
To put SMO into context, I consider it as a programmatic way to interact
with SSMS.
For CRUD actions, SqlClient is
still very good. Very flexible compared to entity framework.
However, when we need extra
flexibility, e.g., create/backup database, create/alter tables, especially
running SQL with GO statement, SMO is the way to go.
I’ve attached a Util class that
demonstrates how it can be wrapped, and the dynamic SQL that gets generated by
my program and executed via the Util class.
If you would like to know more,
plenty of articles on MSND:
SQL Server Management Objects (SMO) is a collection of objects
that are designed for programming all aspects of managing Microsoft SQL
Server