Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

SqlDbType Enum

Definition

Namespace:
System.Data
Assemblies:
netstandard.dll, System.Data.Common.dll
Assembly:
System.Data.SqlClient.dll
Assembly:
System.Data.Common.dll
Assembly:
System.Data.dll
Assembly:
netstandard.dll
Source:
SqlDbType.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Specifies SQL Server-specific data type of a field, property, for use in aSqlParameter.

public enum class SqlDbType
public enum SqlDbType
type SqlDbType =
Public Enum SqlDbType
Inheritance

Fields

NameValueDescription
BigInt0

Int64. A 64-bit signed integer.

Binary1

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

Bit2

Boolean. An unsigned numeric value that can be 0, 1, ornull.

Char3

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

DateTime4

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

Decimal5

Decimal. A fixed precision and scale numeric value between -1038 -1 and 1038 -1.

Float6

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

Image7

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

Int8

Int32. A 32-bit signed integer.

Money9

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

NChar10

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

NText11

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

NVarChar12

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. UseNVarChar when the database column isnvarchar(max).

Real13

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

UniqueIdentifier14

Guid. A globally unique identifier (or GUID).

SmallDateTime15

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

SmallInt16

Int16. A 16-bit signed integer.

SmallMoney17

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

Text18

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

Timestamp19

Array of typeByte. 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.

TinyInt20

Byte. An 8-bit unsigned integer.

VarBinary21

Array of typeByte. 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.

VarChar22

String. A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters. UseVarChar when the database column isvarchar(max).

Variant23

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.

Xml25

An XML value. Obtain the XML as a string using theGetValue(Int32) method orValue property, or as anXmlReader by calling theCreateReader() method.

Udt29

A SQL Server user-defined type (UDT).

Structured30

A special data type for specifying structured data contained in table-valued parameters.

Date31

Date data ranging in value from January 1,1 AD through December 31, 9999 AD.

Time32

Time data based on a 24-hour clock. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. Corresponds to a SQL Servertime value.

DateTime233

Date and time data. Date value range is from January 1,1 AD through December 31, 9999 AD. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds.

DateTimeOffset34

Date and time data with time zone awareness. Date value range is from January 1,1 AD through December 31, 9999 AD. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. Time zone value range is -14:00 through +14:00.

Json35

A JSON value.

Vector36

Remarks

When setting command parameters, theSqlDbType andDbType are linked. Therefore, setting theDbType changes theSqlDbType to a supportingSqlDbType.

Applies to

See also

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo