Export (0) Print
Expand All

ScriptingOptions Constructor (ScriptingOptions)

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

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

public ScriptingOptions(
	ScriptingOptions so
)

Parameters

so
Type: Microsoft.SqlServer.Management.Smo.ScriptingOptions
A ScriptingOptions object value that specifies the script options.

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)
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft