The correspondence between C # data types and SQL and the range of values

Source: Internet
Author: User
Tags table definition

Short
Name . NET Class Type Width Range (BITS) SQL Datatype (Closest Match) Constraint to use (if needed in table definition)

Byte

Byte

Unsigned integer

8

0 to 255

tinyint

SByte

SByte

Signed integer

8

-128 to 127

smallint [ColName] Between-128 and 127

Int

Int32

Signed integer

32

-2,147,483,648 to 2,147,483,647

Int

UInt

UInt32

Unsigned integer

32

0 to 4294967295

bigint [ColName] Between 0 and 4294967295

Short

Int16

Signed integer

16

-32,768 to 32,767

smallint

UShort

UInt16

Unsigned integer

16

0 to 65535

Int [ColName] Between 0 and 65535

Long

Int64

Signed integer

64

-922337203685477508 to 922337203685477507

bigint

ULong

UInt64

Unsigned integer

64

0 to 18446744073709551615

Decimal (20,0) [ColName] Between 0 and 18446744073709551615

Float

Single

Single-precision floating Point type

32

-3.402823e38 to 3.402823e38

Real

Double

Double

Double-precision floating Point type

64

-1.79769313486232e308 to 1.79769313486232e308

Float

bool

Boolean

Logical Boolean Type

8

True or False

Bit

Decimal

Decimal

Precise fractional or integral type that can represent decimal numbers with significant digits

128

±1.0x10e-28 To±7.9x10e28

Decimal (can go-significant in SQL need-to-limit to-here.)



The correspondence between C # data types and SQL and the range of values

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.