SQL Server 2008 Data types

Source: Internet
Author: User

Serial number

Data type

Length

Description

1

Int

4

Self-amplification logo

2

tinyint

1

Shaping (0 to 255)

3

smallint

2

Shaping ( -2^15 to 2^15)

4

Int

4

Shaping ( -2^32 to 2^32)

5

bigint

8

64-bit shaping ( -2^63 to 2^63-1)

6

Float

8

Floating-point type ( -1.79e + 308 to -2.23E-308, 0, and 2.23E-308 to 1.79E + 308)

7

Real

4

Floating-point type ( -3.40e + 38 to -1.18E-38, 0, and 1.18E-38 to 3.40E + 38)

8

Numeric

9

Float type (-10^38 +1 to 10^38-1)

9

Decimal

9

Float type (-10^38 +1 to 10^38-1)

10

Money

8

Currency data type (-922 billion to 922 billion)

11

SmallMoney

4

Currency data type (-214748.3648 to 214748.3647)

12

Bit

1

Logical data types (integer data types that can have a value of 1, 0, or NULL)

13

Binary

50

Binary data type, fixed length (where n is a value from 1 to 8,000)

14

varbinary

50

Binary data type, variable length (where n is a value from 1 to 8,000)

15

varbinary

MAX

Binary data type, variable length (where n is a value from 1 to 8,000)

16

Image

16

Up to 231–1 (2?147?483?647) hexadecimal digits

17

Char

10

Character type, fixed length (n values range from 1 to 8,000)

18

NChar

10

The character type (a positive integer between 0 and 65535.) If a value beyond this range is specified, NULL is returned. )

19

varchar

50

Character type (n values range from 1 to 8,000)

20

nvarchar

50

Character type (n values range from 1 to 4,000)

21st

varchar

MAX

The storage size is the actual length of the input data plus 2 bytes, and Max indicates that the maximum storage size is 2^31-1 bytes

22

nvarchar

0

The storage size is twice times the number of characters entered and 2 bytes, max indicates the maximum storage size is 2^31-1 bytes

23

Text

16

Variable-length non-Unicode data with a maximum length of 2^31-1 (2,147,483,647) characters

24

ntext

16

Variable-length Unicode data with a maximum length of 2^30-1 (1,073,741,823) characters

25

Date

3

Date Time type (Yyyy-mm-dd 0001-01-01 to 9999-12-31)

26

Time

5

Hours: minutes: seconds. N between 9999999,0~7 specify fractional seconds

27

Datetime

8

Date Time type (YYYY-MM-DD hh:mm:ss[.nnn] 1753-01-01 to 9999-12-31)

28

DateTime2

8

DateTime type (YYYY-MM-DD hh:mm:ss[.nnnnnnn]] 0001-01-01 00:00:00.0000000 to 9999-12-31 23:59:59.9999999)

29

DateTimeOffset

10

DateTime type (YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm) 0001-01-01 00:00:00.0000000 to 9999-12-31 23:59:59.9999999 (expressed in UTC time)

30

smalldatetime

4

smalldatetime accounted for 4 bytes, precision 1 minutes, time from 1900.1.1 to 2079.6.6

31

Timestamp

8

This data type is unique in every table! When one record in the table changes, the timestamp field of the record is automatically updated.

32

uniqueidentifier

16

GUID Global unique Tag

33

Xml

MAX

XML, the stored XML data type indicates that the instance size cannot exceed 2 GB

37

sql_variant

8016

The maximum length of the sql_variant can be 8,016 bytes. This includes base type information and base type values. The maximum length of the actual base type value is 8, 000 bytes.

38

Geography

Provides a storage structure defined by a union of longitude and latitude for spatial data

39

Geometry

Provides a storage structure for spatial data, which is defined by coordinates on any plane.

40

Hierarchyid

 

Related Article

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.