Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataType.DateTime2 Method

datetime2 is an extension of the existing datetime type. It has a large date range and large default fractional precision. It has a length of at least 19 positions.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
public static DataType DateTime2(
	int scale
)

Parameters

scale
Type: System.Int32
An Int32 value which represents the scale (precision) of the result.

Return Value

Type: Microsoft.SqlServer.Management.Smo.DataType
A DataType object value that specifies a DateTime2 definition in the data type.

The returned DateTime2 object constructor is initialized with the scale value that determines the precision of the DateTime2 object.

Visual Basic

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

PowerShell

$dt = new-object Microsoft.SqlServer.Management.Smo.DataType([Microsoft.SqlServer.Management.Smo.SqlDataType]::DateTime2, 10)
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.