ScriptingOptions.ScriptDrops Property
Gets or sets the Boolean property value that specifies whether the script operation generates a Transact-SQL script to remove the referenced component.
Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Syntax
'Deklaracja
Public Property ScriptDrops As Boolean
public bool ScriptDrops { get; set; }
public:
property bool ScriptDrops {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_ScriptDrops ()
/** @property */
public void set_ScriptDrops (boolean value)
public function get ScriptDrops () : boolean
public function set ScriptDrops (value : boolean)
Property Value
A Boolean value that specifies whether to include drop clauses to remove objects in the generated script. If True, the script operation generates a Transact-SQL script to remove the referenced component. If False (default), the script operation generates a Transact-SQL script to create the referenced component.
Remarks
If the option is set to True, the script tests for existence before attempting to remove an object.
The table indicates the scripting behavior based on the combination of ScriptSchema, ScriptData, and ScriptDrops property values.
Property Values |
Scripting Behavior |
ScriptSchema = True ScriptData = False ScriptDrops = False |
Only the schema will be scripted. This is the default. |
ScriptSchema = True ScriptData = True ScriptDrops = False |
Both the schema and the data will be scripted. The Drop statement for existing data will not be scripted because the script generated will first create the table and then insert the data. Data does not exist in the tables to begin with. |
ScriptSchema = True ScriptData = False ScriptDrops = True |
Only statements for objects to be dropped will be scripted. |
ScriptSchema = True ScriptData = True ScriptDrops = True |
The script will contain Drop statement for objects. Because data will be deleted when the objects are dropped, Delete statements will not be scripted. |
ScriptSchema = False ScriptData = False ScriptDrops = any value |
An error will be raised informing the user that at least one of ScriptSchema and ScriptData properties must be set to true. |
ScriptSchema = False ScriptData = True ScriptDrops = False |
Only the data will be scripted. Delete statements for removing existing data before inserting new data will not be scripted. |
ScriptSchema = False ScriptData = True ScriptDrops = True |
Only the script for dropping data will be generated. This behavior is consistent with how the schema is handled. |
Thread Safety
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server.
Target Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server.