SQL-DMO Objects and SQL Server Administration
SQL-DMO encapsulates Microsoft® SQL Server™ components, presenting the attributes of the component piece to you as the properties of an object instance. Alter the properties of the instance, or use object methods to automate SQL Server administration.
An instance of SQL Server may be viewed as a collection of components. A component is not simply a database object or a system database record, such as that defining an operator. It can be a more abstract construct, such as the current configuration of an instance of SQL Server. For example:
- An instance of SQL Server is installed by a user. The name of the user whom installs SQL Server is captured in the registry of the computer on which an instance of SQL Server resides.
- The SQL Server Northwind sample database is implemented in physical files in a specific subdirectory of a disk drive. At any given point in time, the usage of space within those physical files can be measured.
- The Northwind..Categories table has four columns.
With SQL-DMO, you can use:
- The Registry object RegisteredOwner property as part of an installation of an instance of SQL Server.
- The Database object PrimaryFilePath and DataSpaceUsage properties as part of an automated data integrity check system.
- The Count property of the Columns collection of a Table object to set the number of pages on a property sheet that presents column definitions.
Essentially, SQL-DMO has three object types:
- An object is a stand-alone object that references a single SQL Server component, such as the Table object.
- A collection is a container object that allows members to be added and removed, such as the Tables collection.
- A list is a container object that is fixed in membership, such as the SQLObjectList object list.
All SQL-DMO objects expose properties, such as Name or Count, identifying instance data. Most expose methods, such as BindToColumn or MSXEnlist, which act upon an instance and usually modify instance data in some fashion. A few objects support events, such as PercentComplete, which provide object state or other data back to the client application.