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

Data Type List SQL

The document describes different data types that can be used in SQL Server including string, numeric, and date/time data types. String data types include both fixed and variable width for characters and Unicode text. Numeric types support whole numbers, decimals, and floating point numbers. Date/time types allow storage of dates, times, and timestamps.

Uploaded by

Utkarsh Miglani
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Data Type List SQL

The document describes different data types that can be used in SQL Server including string, numeric, and date/time data types. String data types include both fixed and variable width for characters and Unicode text. Numeric types support whole numbers, decimals, and floating point numbers. Date/time types allow storage of dates, times, and timestamps.

Uploaded by

Utkarsh Miglani
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Data type Description

char(n) Fixed width character string


varchar(n) Variable width character string
varchar(max) Variable width character string
text Variable width character string
nchar Fixed width Unicode string
nvarchar Variable width Unicode string
nvarchar(max) Variable width Unicode string
ntext Variable width Unicode string
binary(n) Fixed width binary string
varbinary Variable width binary string
varbinary(max) Variable width binary string

String Data Types

Numeric Data Types


Data type Description
bit Integer that can be 0, 1, or NULL
tinyint Allows whole numbers from 0 to 255
smallint Allows whole numbers between -32,768
and 32,767
int Allows whole numbers between -
2,147,483,648 and 2,147,483,647
bigint Allows whole numbers between -
9,223,372,036,854,775,808 and
9,223,372,036,854,775,807
decimal(p,s)
Fixed precision and scale numbers.

Allows numbers from -10^38 +1 to 10^38 –1.

The p parameter indicates the maximum total


number of digits that can be stored (both to
the left and to the right of the decimal point).
p must be a value from 1 to 38. Default is 18.

The s parameter indicates the maximum


number of digits stored to the right of the
decimal point. s must be a value from 0 to p.
Default value is 0
numeric(p,s) Fixed precision and scale numbers.

Allows numbers from -10^38 +1 to 10^38 –1.


The p parameter indicates the maximum total
number of digits that can be stored (both to
the left and to the right of the decimal point).
p must be a value from 1 to 38. Default is 18.

The s parameter indicates the maximum


number of digits stored to the right of the
decimal point. s must be a value from 0 to p.
Default value is 0
smallmoney Monetary data from -214,748.3648 to
214,748.3647
money Monetary data from -
922,337,203,685,477.5808 to
922,337,203,685,477.5807
float(n) Floating precision number data from -1.79E
+ 308 to 1.79E + 308.
The n parameter indicates whether the field
should hold 4 or 8 bytes. float(24) holds a 4-
byte field and float(53) holds an 8-byte field.
Default value of n is 53.
real Floating precision number data from -3.40E
+ 38 to 3.40E + 38

Data type Description


datetime From January 1, 1753 to December 31, 9999
with an accuracy of 3.33 milliseconds
datetime2 From January 1, 0001 to December 31, 9999
with an accuracy of 100 nanoseconds
smalldatetime From January 1, 1900 to June 6, 2079 with an
accuracy of 1 minute
date Store a date only. From January 1, 0001 to
December 31, 9999
time Store a time only to an accuracy of 100
nanoseconds
datetimeoffset The same as datetime2 with the addition of a
time zone offset
timestamp Stores a unique number that gets updated
every time a row gets created or modified. The
timestamp value is based upon an internal clock
and does not correspond to real time. Each
table may have only one timestamp variable

You might also like