SQL Server Data Types
SQL Server Data Types
char(n) It is a fixed width character string data type. Its size can be up to 8000
characters.
varchar(n) It is a variable width character string data type. Its size can be up to
8000 characters.
varchar(max) It is a variable width character string data types. Its size can be up to
1,073,741,824 characters.
text It is a variable width character string data type. Its size can be up to 2GB
of text data.
nchar It is a fixed width Unicode string data type. Its size can be up to 4000
characters.
nvarchar It is a variable width Unicode string data type. Its size can be up to 4000
characters.
ntext It is a variable width Unicode string data type. Its size can be up to 2GB
of text data.
binary(n) It is a fixed width Binary string data type. Its size can be up to 8000
bytes.
varbinary It is a variable width Binary string data type. Its size can be up to 8000
bytes.
image It is also a variable width Binary string data type. Its size can be up to
2GB.
2. SQL Server Numeric Data Types
datetime It is used to specify date and time combination. It supports range from
January 1, 1753, to December 31, 9999 with an accuracy of 3.33
milliseconds.
datetime2 It is used to specify date and time combination. It supports range from
January 1, 0001 to December 31, 9999 with an accuracy of 100
nanoseconds
date It is used to store date only. It supports range from January 1, 0001 to
December 31, 9999
timestamp It stores a unique number when a new row gets created or modified.
The time stamp value is based upon an internal clock and does not
correspond to real time. Each table may contain only one-time stamp
variable.
4. SQL Server Other Data Types
Sql_variant It is used for various data types except for text, timestamp, and
ntext. It stores up to 8000 bytes of data.