When to use SQL Server Management Objects
Those are some SMO basics and potential areas of use. So when does it make sense to use SMO instead of or in addition to using T-SQL? Here are a few examples:
- Monitoring applications (server uptime, database space, backups)
- Applications that generate SQL Server documentation (servers, settings, databases)
- Scripting automation (many objects exposed in SMO are scriptable with a variety of options)
- Applications that collect and store server and database trends and statistics
- Programming management and maintenance utilities for SQL Server Express to compensate for the lack of SSMS and SQL Server Agent
Unfortunately, the SMO documentation in SQL Server Books Online is very dry and contains just basic descriptions of the classes. It includes no overview, suggestions for using SMO, or best practices. Fortunately, there are many useful code samples on the CodePlex website that you can download, explore and utilize in your own SMO applications.
SQL Server
sql server