DataType DataType DataType Class

Definition

The DataType object represents a SQL Server data type.

public ref class DataType : System::Xml::Serialization::IXmlSerializable
public class DataType : System.Xml.Serialization.IXmlSerializable
Public Class DataType
Implements IXmlSerializable
Inheritance
DataTypeDataTypeDataType
Implements

Examples

Working with Data Types

Remarks

The DataType object is used to specify the type of data that is associated primarily with columns and parameters.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Constructors

DataType() DataType() DataType()

Initializes a new instance of the DataType class.

DataType(SqlDataType, String, String) DataType(SqlDataType, String, String) DataType(SqlDataType, String, String)

Initializes a new instance of the DataType class based on a specified SQL Server data type with the specified type and schema.

DataType(SqlDataType, String) DataType(SqlDataType, String) DataType(SqlDataType, String)

Initializes a new instance of the DataType class based on a specified SQL Server data type with the specified type.

DataType(SqlDataType, Int32) DataType(SqlDataType, Int32) DataType(SqlDataType, Int32)

Initializes a new instance of the DataType class based on a specified SQL Server data type with specified precision or maximum length.

DataType(XmlSchemaCollection) DataType(XmlSchemaCollection) DataType(XmlSchemaCollection)

Initializes a new instance of the DataType class based on a specified XML schema collection.

DataType(SqlDataType, Int32, Int32) DataType(SqlDataType, Int32, Int32) DataType(SqlDataType, Int32, Int32)

Initializes a new instance of the DataType class based on a specified SQL Server data type with the specified precision and scale.

DataType(UserDefinedTableType) DataType(UserDefinedTableType) DataType(UserDefinedTableType)

Initializes a new instance of the DataType class based on a specified user-defined table type.

DataType(UserDefinedDataType) DataType(UserDefinedDataType) DataType(UserDefinedDataType)

Initializes a new instance of the DataType class based on a specified user-defined data type.

DataType(SqlDataType) DataType(SqlDataType) DataType(SqlDataType)

Initializes a new instance of the DataType class based on a specified SQL Server data type.

DataType(UserDefinedType) DataType(UserDefinedType) DataType(UserDefinedType)

Initializes a new instance of the DataType class based on a specified user-defined type.

Properties

BigInt BigInt BigInt

Gets a data type that specifies the BigInt definition used in the data type.

Bit Bit Bit

Gets a data type that specifies the Bit definition used in the data type.

Date Date Date

The Date property returns a Date data type.

DateTime DateTime DateTime

Gets a data type that specifies the DateTime definition used in the data type.

Float Float Float

Gets a data type that specifies the Float definition used in the data type.

Geography Geography Geography

The geography data type represents data in a round-earth coordinate system. The SQL Server geography data type stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates.

Geometry Geometry Geometry

The Geometry property contains spatial data that represents information about the physical location and shape of geometric objects.

HierarchyId HierarchyId HierarchyId

The HierarchyId property is used to identify a position in a hierarchy.

Image Image Image

Gets a data type that specifies the Image definition used in the data type.

Int Int Int

Gets a data type that specifies the Int definition used in the data type.

IsNumericType IsNumericType IsNumericType

Gets a value whether the data is a numeric type.

IsStringType IsStringType IsStringType

Gets a value whether the object is a string type.

MaximumLength MaximumLength MaximumLength

Gets the maximum length of the data type.

Money Money Money

Gets a data type that specifies the Money definition used in the data type.

Name Name Name

Gets the name of the data type.

NText NText NText

Gets a data type that specifies the NText definition used in the data type.

NumericPrecision NumericPrecision NumericPrecision

Gets or sets the numeric precision of the data type.

NumericScale NumericScale NumericScale

Gets or sets the numeric scale of the data type.

NVarCharMax NVarCharMax NVarCharMax

Gets a data type that specifies the VarCharMax definition used in the data type.

Real Real Real

Gets a data type that specifies the Money definition used in the data type.

Schema Schema Schema

Gets or sets the schema of the data type.

SmallDateTime SmallDateTime SmallDateTime

Gets a data type that specifies the SmallDateTime definition used in the data type.

SmallInt SmallInt SmallInt

Gets a data type that specifies the SmallInt definition used in the data type.

SmallMoney SmallMoney SmallMoney

Gets a data type that specifies the SmallMoney definition used in the data type.

SqlDataType SqlDataType SqlDataType

Gets a data type that specifies the SqlDataType definition used in the data type.

SysName SysName SysName

Gets a data type that specifies the SysName definition used in the data type.

Text Text Text

Gets a data type that specifies the Text definition used in the data type.

Timestamp Timestamp Timestamp

Gets a data type that specifies the TimeStamp definition used in the data type.

TinyInt TinyInt TinyInt

Gets a data type that specifies the TinyInt definition used in the data type.

UniqueIdentifier UniqueIdentifier UniqueIdentifier

Gets a data type that specifies the UniqueIdentifier definition used in the data type.

VarBinaryMax VarBinaryMax VarBinaryMax

Gets a data type that specifies the VarBinaryMax definition used in the data type.

VarCharMax VarCharMax VarCharMax

Gets a data type that specifies the VarCharMax definition used in the data type.

Variant Variant Variant

Gets a data type that specifies the Variant definition used in the data type.

XmlDocumentConstraint XmlDocumentConstraint XmlDocumentConstraint

Gets or sets a value that indicates how an XML document is formatted.

Methods

Binary(Int32) Binary(Int32) Binary(Int32)

Returns an object that represents the specified type.

Char(Int32) Char(Int32) Char(Int32)

Returns an object that represents the specified type.

DateTime2(Int32) DateTime2(Int32) DateTime2(Int32)

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.

DateTimeOffset(Int32) DateTimeOffset(Int32) DateTimeOffset(Int32)

Returns values for year, month, day, valid time of day between 00:00:00 and 23:59:59:9999999 and offset, in hours, from UTC. It has a length of at least 25 positions.

Decimal(Int32, Int32) Decimal(Int32, Int32) Decimal(Int32, Int32)

Returns an object that represents the specified type.

Equals(DataType) Equals(DataType) Equals(DataType)

Determines whether the specified data types are considered equal.

Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is considered equal to the current data type.

GetHashCode() GetHashCode() GetHashCode()

This method supports the SQL Server infrastructure and is not intended to be used directly from your code.

NChar(Int32) NChar(Int32) NChar(Int32)

Returns an object that represents the specified type.

Numeric(Int32, Int32) Numeric(Int32, Int32) Numeric(Int32, Int32)

Returns an object that represents the specified type.

NVarChar(Int32) NVarChar(Int32) NVarChar(Int32)

Returns an object that represents the specified type.

Time(Int32) Time(Int32) Time(Int32)

Returns values for any valid time of day between 00:00:00 and 23:59:59:9999999. It has a length of at least eight positions and contains the time in hours, minutes, seconds and fractional seconds.

ToString() ToString() ToString()

Returns the object in string format.

UserDefinedDataType(String) UserDefinedDataType(String) UserDefinedDataType(String)

Returns an object that represents the specified type.

UserDefinedDataType(String, String) UserDefinedDataType(String, String) UserDefinedDataType(String, String)

Returns an object that represents the specified type with the specified schema.

UserDefinedTableType(String) UserDefinedTableType(String) UserDefinedTableType(String)

Returns an object that represents the specified type.

UserDefinedTableType(String, String) UserDefinedTableType(String, String) UserDefinedTableType(String, String)

Returns an object that represents the specified type with the specified schema.

UserDefinedType(String) UserDefinedType(String) UserDefinedType(String)

Returns an object that represents the specified type.

UserDefinedType(String, String) UserDefinedType(String, String) UserDefinedType(String, String)

Returns an object that represents the specified type with the specified schema.

VarBinary(Int32) VarBinary(Int32) VarBinary(Int32)

Returns an object that represents the specified type.

VarChar(Int32) VarChar(Int32) VarChar(Int32)

Returns an object that represents the specified type.

Xml(String, String) Xml(String, String) Xml(String, String)

Returns an object that represents the specified type and with the specified schema.

Xml(String, String, XmlDocumentConstraint) Xml(String, String, XmlDocumentConstraint) Xml(String, String, XmlDocumentConstraint)

Returns an object that represents the specified type, schema and XML document constraint.

Xml(String) Xml(String) Xml(String)

Returns an object that represents the specified type.

Explicit Interface Implementations

IXmlSerializable.GetSchema() IXmlSerializable.GetSchema() IXmlSerializable.GetSchema()

Not implemented.

IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader) IXmlSerializable.ReadXml(XmlReader)

Deserializes the DAC type properties from an XML stream. Identified for informational purposes only. Not supported. Future compatibility is not guaranteed..

IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter) IXmlSerializable.WriteXml(XmlWriter)

Serializes the data type properties to an XML stream. Identified for informational purposes only. Not supported. Future compatibility is not guaranteed..

Applies to