Dela via


DataType.VarChar Method

Returns an object that represents the specified type.

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

Syntax

'Declaration
Public Shared Function VarChar ( _
    maxLength As Integer _
) As DataType
'Usage
Dim maxLength As Integer
Dim returnValue As DataType

returnValue = DataType.VarChar(maxLength)
public static DataType VarChar(
    int maxLength
)
public:
static DataType^ VarChar(
    int maxLength
)
static member VarChar : 
        maxLength:int -> DataType 
public static function VarChar(
    maxLength : int
) : DataType

Parameters

  • maxLength
    Type: System.Int32
    An Int32 value that specifies the maximum length of the data type.

Return Value

Type: Microsoft.SqlServer.Management.Smo.DataType
A DataType object value.

Examples

Visual Basic

Dim dt As DataType
dt = New DataType(SqlDataType.VarChar, 10)

PowerShell

$dt = new-object Microsoft.SqlServer.Management.Smo.DataType([Microsoft.SqlServer.Management.Smo.SqlDataType]::VarChar, 10)