다음을 통해 공유


ScriptingOptions.ScriptSchema 속성

Gets or set the ScriptSchema property value.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
Public Property ScriptSchema As Boolean 
    Get 
    Set
‘사용 방법
Dim instance As ScriptingOptions 
Dim value As Boolean 

value = instance.ScriptSchema

instance.ScriptSchema = value
public bool ScriptSchema { get; set; }
public:
property bool ScriptSchema {
    bool get ();
    void set (bool value);
}
member ScriptSchema : bool with get, set
function get ScriptSchema () : boolean 
function set ScriptSchema (value : boolean)

속성 값

유형: System.Boolean
A Boolean value that indicates whether the schema is scripted.If True, the schema is scripted. Otherwise it is not.

주의

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.

The following code example specifies that only the script used for dropping data will be generated.

Visual Basic

Dim scOps As New ScriptingOptions()
scOps.ScriptData = true
scOps.ScriptDrops = true
scOps.ScriptSchema = false

PowerShell

$scOps = New-Object Microsoft.SqlServer.Management.Smo.ScriptingOptions
$scOps.ScriptData = $TRUE
$scOps.ScriptDrops = $TRUE
$scOps.ScriptSchema = $FALSE

참고 항목

참조

ScriptingOptions 클래스

Microsoft.SqlServer.Management.Smo 네임스페이스

관련 자료

스크립팅