Compartir a través de


SetTargetServerVersion Método

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

Espacio de nombres:  Microsoft.SqlServer.Management.Smo
Ensamblado:  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Sintaxis

'Declaración
Public Sub SetTargetServerVersion ( _
    ver As ServerVersion _
)
'Uso
Dim instance As ScriptingOptions
Dim ver As ServerVersion

instance.SetTargetServerVersion(ver)
public void SetTargetServerVersion(
    ServerVersion ver
)
public:
void SetTargetServerVersion(
    ServerVersion^ ver
)
member SetTargetServerVersion : 
        ver:ServerVersion -> unit 
public function SetTargetServerVersion(
    ver : ServerVersion
)

Parámetros

Ejemplos

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)