System.Data.SqlDbType Enumeration

Specifies SQL Server-specific data type of a field, property, for use in a System.Data.SqlClient.SqlParameter.

Syntax

public enum SqlDbType

Remarks

When setting command parameters, the System.Data.SqlDbType and System.Data.DbType are linked. Therefore, setting the DbType changes the SqlDbType to a supporting SqlDbType.

Members

Member NameDescription
BigInt

long. A 64-bit signed integer.

Binary

Array of type byte. A fixed-length stream of binary data ranging between 1 and 8,000 bytes.

Bit

bool. An unsigned numeric value that can be 0, 1, or null.

Char

string. A fixed-length stream of non-Unicode characters ranging between 1 and 8,000 characters.

DateTime

DateTime. Date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds.

Decimal

decimal. A fixed precision and scale numeric value between -10 -1 and 10 -1.

Float

double. A floating point number within the range of -1.79E +308 through 1.79E +308.

Image

Array of type byte. A variable-length stream of binary data ranging from 0 to 2 -1 (or 2,147,483,647) bytes.

Int

int. A 32-bit signed integer.

Money

decimal. A currency value ranging from -2 (or -9,223,372,036,854,775,808) to 2 -1 (or +9,223,372,036,854,775,807) with an accuracy to a ten-thousandth of a currency unit.

NChar

string. A fixed-length stream of Unicode characters ranging between 1 and 4,000 characters.

NText

string. A variable-length stream of Unicode data with a maximum length of 2 - 1 (or 1,073,741,823) characters.

NVarChar

string. A variable-length stream of Unicode characters ranging between 1 and 4,000 characters. Implicit conversion fails if the string is greater than 4,000 characters. Explicitly set the object when working with strings longer than 4,000 characters. Use SqlDbType.NVarChar when the database column is nvarchar(max).

Real

float. A floating point number within the range of -3.40E +38 through 3.40E +38.

SmallDateTime

DateTime. Date and time data ranging in value from January 1, 1900 to June 6, 2079 to an accuracy of one minute.

SmallInt

short. A 16-bit signed integer.

SmallMoney

decimal. A currency value ranging from -214,748.3648 to +214,748.3647 with an accuracy to a ten-thousandth of a currency unit.

Text

string. A variable-length stream of non-Unicode data with a maximum length of 2 -1 (or 2,147,483,647) characters.

Timestamp

Array of type byte. Automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.

TinyInt

byte. An 8-bit unsigned integer.

Udt

A ssNoVersion user-defined type (UDT).

UniqueIdentifier

Guid. A globally unique identifier (or GUID).

VarBinary

Array of type byte. A variable-length stream of binary data ranging between 1 and 8,000 bytes. Implicit conversion fails if the byte array is greater than 8,000 bytes. Explicitly set the object when working with byte arrays larger than 8,000 bytes.

VarChar

string. A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters. Use SqlDbType.VarChar when the database column is varchar(max).

Variant

object. A special data type that can contain numeric, string, binary, or date data as well as the SQL Server values Empty and Null, which is assumed if no other type is declared.

Xml

An XML value. Obtain the XML as a string using the System.Data.SqlClient.SqlDataReader.GetValue(int) method or System.Data.SqlTypes.SqlXml.Value property, or as an System.Xml.XmlReader by calling the System.Data.SqlTypes.SqlXml.CreateReader method.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0