0% found this document useful (0 votes)
17 views

Data Types SQL

The document discusses the various data types available in SQL Server 2008. It outlines 10 numeric data types including integer, monetary, and decimal types, along with their storage sizes and value ranges. Character data types like char, varchar, text, nchar and nvarchar are also described. Date/time types such as smalldatetime, datetime and time are presented along with their value ranges. Binary data types including bit are also mentioned.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Data Types SQL

The document discusses the various data types available in SQL Server 2008. It outlines 10 numeric data types including integer, monetary, and decimal types, along with their storage sizes and value ranges. Character data types like char, varchar, text, nchar and nvarchar are also described. Date/time types such as smalldatetime, datetime and time are presented along with their value ranges. Binary data types including bit are also mentioned.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

SQL Server

2008
Data Types

Data types are the most


fundamental constraint
element of a database in
that it restricts the range
of possible values that
are allowed to be stored
within a column.

Numeric data
One of the most common
data types that you will
find within SQL Server
are numeric data types.
There are ten numeric
data types that ship with
SQL Server 2008.

* Four data types are


designed to store integer
values of various sizes.
* Two data types are
designed to store
monetary data.
* Three data types are
designed to store
decimal-based numbers

Data Type

Range of Value

Storage
Space

tinyint

0 to 255

1 byte

smallint

-32,768 to 32,767

2 bytes

int

-231 to 231 -1

4 bytes

bigint

-263 to 263 -1

8 bytes

decimal(p,s)
numeric(p,s)

-1038 to 1038 -1

5 to 17 bytes

smallmoney

-214,748.3648 to 214,748.3647

4 bytes

money

-922,337,203,685,477.5808 to
922,337,203,685,477.5807

8 bytes

real

-3.438 to -1.1838 , 0, and 1.1838


to 3.438

4 bytes

Float

-1.79308 to -2.23308 , 0, and


2.23308 to 1.79308

4 bytes or 8
bytes

Character data type


char(n) - 1 byte per
character defined by n up
to a maximum of 8000
bytes
varchar(n) -1 byte per
character stored up to a
maximum of 8000 bytes

Character data type


text -1 byte per
character stored up to a
maximum of 2 GB
nchar(n) -2 bytes per
character defined by n up
to a maximum of 4000
bytes

Character data type


nvarchar(n)- 2 bytes per
characters stored up to a
maximum of 4000 bytes
ntext- 2 bytes per
character stored up to a
maximum of 2 GB

Date and Time Data


smalldatetime
01/01/1900
to
06/06/2079
datetime
01/01/1753 to
12/31/9999

Date and Time Data


time
00:00:00.0000000
to 23:59:59.9999999

Binary Data
bit
Null, 0 and 1
bit

You might also like