ScriptingOptions 构造函数 (ScriptingOptions)

Initializes a new instance of the ScriptingOptions class based on the specified scripting options.

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
Public Sub New ( _
    so As ScriptingOptions _
)
用法
Dim so As ScriptingOptions 

Dim instance As New ScriptingOptions(so)
public ScriptingOptions(
    ScriptingOptions so
)
public:
ScriptingOptions(
    ScriptingOptions^ so
)
new : 
        so:ScriptingOptions -> ScriptingOptions
public function ScriptingOptions(
    so : ScriptingOptions
)

参数

示例

The following code example creates a new instance of the ScriptingOptions class and uses it to configure a Scripter.

Visual Basic

'Connect to the default, local instance of SQLServer
Dim srv As Server
srv = New Server("(local)")

'Set the options of a scripter working on the local server
Dim scrp As Scripter
scrp = New Scripter(srv)
scrp.Options.ScriptDrops = false
scrp.Options.WithDependencies = true

'Create a ScriptingOptions instance from the Scripters already-configured options.
Dim scriptingOptions As ScriptingOptions
scriptingOptions = New ScriptingOptions(scrp.Options)

PowerShell

$srv = New-Object Microsoft.SqlServer.Management.Smo.Server("(local)")

$scrp = New-Object Microsoft.SqlServer.Management.Smo.Scripter($srv)
$scrp.Options.ScriptDrops = $FALSE
$scrp.Options.WithDependencies = $TRUE

$scriptingOptions = New-Object Microsoft.SqlServer.Management.Smo.ScriptingOptions($scrp.Options)

请参阅

参考

ScriptingOptions 类

ScriptingOptions 重载

Microsoft.SqlServer.Management.Smo 命名空间

其他资源

脚本撰写