Export (0) Print
Expand All

ScriptingOptions.SetTargetServerVersion Method (ServerVersion)

 

Applies To: SQL Server 2016 Preview

Sets the version of the instance of SQL Server on which the scripting operation is run.

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

public void SetTargetServerVersion(
	ServerVersion ver
)

Parameters

ver
Type: Microsoft.SqlServer.Management.Common.ServerVersion

A ServerVersion object value that specifies the version of the instance of SQL Server.

Legacy Code Example

The following code example sets the version number of the server upon which the script will run.

Visual Basic

Dim scOps As New ScriptingOptions()
Dim sVersion As New ServerVersion(2, 0)
scOps.SetTargetServerVersion(sVersion)

PowerShell

$scOps = New-Object Microsoft.SqlServer.Management.Smo.ScriptingOptions
$sVersion = New-Object Microsoft.SqlServer.Management.Common.ServerVersion(2,0)
$scOps.SetTargetServerVersion($sVersion)
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft