Working with Database Objects
The stages of SMO object creation are as follows:
Create an instance of the object.
Set the object properties.
Create instances of the child objects.
Set the child object properties.
Create the object.
When instances of SMO objects are created in an SMO application, they do not exist on the instance of SQL Server until the Create() method is issued. However, it is not necessary to issue a Create method for every individual object. If an object has a set of child objects, only the parent object is required to run the Create method. For example, the definition of a table requires that it contains at least one column to exist. Also, a column cannot exist in isolation without a table. There is a codependent relationship between the table and its columns.
The Alter method lets you make changes to an object. Several changes to an object, such as adding child objects to one of the object's collections or changing a property value, are batched together and run as one. The Alter method reduces network traffic and improves overall performance.
The Drop statement is used to remove an object and all its codependent child objects that were required to create the object initially.