Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ScriptingOptions.TargetServerVersion Property

Gets or sets the version of the instance of SQL Server for which the generated script is intended.

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

'Declaration
Public Property TargetServerVersion As SqlServerVersion 
	Get 
	Set
'Usage
Dim instance As ScriptingOptions 
Dim value As SqlServerVersion 

value = instance.TargetServerVersion

instance.TargetServerVersion = value

Property Value

Type: Microsoft.SqlServer.Management.Smo.SqlServerVersion
A SqlServerVersion object value that specifies the version of the instance of SQL Server.

The default value of this property is Version80.

The following code example specifies that the script owner will be listed in the generated script.

Visual Basic

Dim scOps As New ScriptingOptions()
scOps.TargetServerVersion = SqlServerVersion.Version100

PowerShell

$scOps = New-Object Microsoft.SqlServer.Management.Smo.ScriptingOptions
$scOps.TargetServerVersion = [Microsoft.SqlServer.Management.Smo.SqlServerVersion]::Version100

Community Additions

Show:
© 2015 Microsoft