DataType Class

Definition

The DataType object allows users to define a SQL Server data type.

public class DataType : System.Xml.Serialization.IXmlSerializable
type DataType = class
    interface IXmlSerializable
Public Class DataType
Implements IXmlSerializable
Inheritance
DataType
Implements

Constructors

DataType()

Creates a new DataType object.

DataType(SqlDataType)

Creates a new DataType object. The sqlDataType specifies the SQL Server data type.

DataType(SqlDataType, Int32)

Creates a new DataType object. The sqlDataType specifies the SQL Server data type. MaxLength specifies the maximum length of the type. In case of Decimal or Numeric, maxLength specifies the precision.

DataType(SqlDataType, Int32, Int32)

Creates a new DataType object. The sqlDataType specifies the SQL Server data type. Precision and scale define the numeric precision and scale of Decimal and Numeric types. The scale may be 0.

DataType(SqlDataType, String)

Creates a new DataType object. The sqlDataType specifies the SQL Server data type. The type parameter specifies a SQL Server type string, i.e. "varchar(10)", an Xml schema collection, a user defined type, or a user defined type.

DataType(SqlDataType, String, String)

Creates a new DataType object. The sqlDataType specifies the SQL Server data type. The type parameter specifies a SQL Server type string, i.e. "varchar(10)", an Xml schema collection, a user defined type, or a user defined type.

DataType(UserDefinedDataType)

Allows a DataType object to be created based on a UserDefinedDataType instance.

DataType(UserDefinedTableType)

Allows a DataType object to be created based on a UserDefinedTableType instance.

DataType(UserDefinedType)

Allows a DataType object to be created based on a UserDefinedType instance.

DataType(XmlSchemaCollection)

Allows a DataType object to be created based on a XmlSchemaCollection instance.

Properties

BigInt

Creates a DataType of type SqlDataType.BigInt

Bit

Creates a DataType of type SqlDataType.Bit

Date

Creates a DataType of type SqlDataType.Date

DateTime

Creates a DataType of type SqlDataType.DateTime

Float

Creates a DataType of type SqlDataType.Float

Geography

Creates a DataType of type SqlDataType.Geography

Geometry

Creates a DataType of type SqlDataType.Geometry

HierarchyId

Creates a DataType of type SqlDataType.HierarchyId

Image

Creates a DataType of type SqlDataType.Image

Int

Creates a DataType of type SqlDataType.Int

IsNumericType

Indicates whether the type is a numeric type or not.

IsStringType

Indicates whether the type is a string type or not.

MaximumLength

Maximum length of type in bytes.

Money

Creates a DataType of type SqlDataType.Money

Name

Name of the type

NText

Creates a DataType of type SqlDataType.NText

NumericPrecision

Maximum precision of type if numeric-based, else 0.

NumericScale

Maximum scale of type if numeric-based, else 0.

NVarCharMax

Creates a DataType of type SqlDataType.NVarCharMax

Real

Creates a DataType of type SqlDataType.Real

Schema

DataType schema

SmallDateTime

Creates a DataType of type SqlDataType.SmallDateTime

SmallInt

Creates a DataType of type SqlDataType.SmallInt

SmallMoney

Creates a DataType of type SqlDataType.SmallMoney

SqlDataType

Specifies the SQL Server data type.

SysName

Creates a DataType of type SqlDataType.SysName

Text

Creates a DataType of type SqlDataType.Text

Timestamp

Creates a DataType of type SqlDataType.Timestamp

TinyInt

Creates a DataType of type SqlDataType.TinyInt

UniqueIdentifier

Creates a DataType of type SqlDataType.UniqueIdentifier

VarBinaryMax

Creates a DataType of type SqlDataType.VarBinaryMax

VarCharMax

Creates a DataType of type SqlDataType.VarCharMax

Variant

Creates a DataType of type SqlDataType.Variant

XmlDocumentConstraint

Specifies whether the XML data type is a fragment (content) or a well-formed XML 1.0 instance (document).

Methods

Binary(Int32)

Creates a DataType of type SqlDataType.Binary

Char(Int32)

Creates a DataType of type SqlDataType.Char

DateTime2(Int32)

Creates a DataType of type SqlDataType.DateTime2

DateTimeOffset(Int32)

Creates a DataType of type SqlDataType.DateTimeOffset

Decimal(Int32, Int32)

Creates a DataType of type SqlDataType.Decimal

Equals(DataType)
Equals(Object)
GetHashCode()
GetSqlName(SqlDataType)

Returns the TSQL name of the given SqlDataType

NChar(Int32)

Creates a DataType of type SqlDataType.NChar

Numeric(Int32, Int32)

Creates a DataType of type SqlDataType.Numeric

NVarChar(Int32)

Creates a DataType of type SqlDataType.NVarChar

SqlToEnum(String)

Converts a string Sql Data Type name into the corresponding SqlDataType enum value. Returns SqlDataType.None if the name is an unknown type.

Time(Int32)

Creates a DataType of type SqlDataType.Time

ToString()
UserDefinedDataType(String)

Creates a DataType of type SqlDataType.UserDefinedDataType

UserDefinedDataType(String, String)

Creates a DataType of type SqlDataType.UserDefinedDataType

UserDefinedTableType(String)

Creates a DataType of SqlDataType.UserDefinedTableType

UserDefinedTableType(String, String)

Creates a DataType of type SqlDataType.UserDefinedTableType

UserDefinedType(String)

Creates a DataType of type SqlDataType.UserDefinedType

UserDefinedType(String, String)

Creates a DataType of type SqlDataType.UserDefinedType

VarBinary(Int32)

Creates a DataType of type SqlDataType.VarBinary

VarChar(Int32)

Creates a DataType of type SqlDataType.VarChar

Xml(String)

Creates a DataType of type SqlDataType.Xml

Xml(String, String)

Creates a DataType of type SqlDataType.Xml

Xml(String, String, XmlDocumentConstraint)

Creates a DataType of type SqlDataType.Xml

Explicit Interface Implementations

IXmlSerializable.GetSchema()
IXmlSerializable.ReadXml(XmlReader)
IXmlSerializable.WriteXml(XmlWriter)

Applies to