SQL Server Datatypes | Table Column Types

Data type
Description and capacity of Data Type
char(n)
To Store Fixed width character string (8,000 chars)
varchar(n)
To Store Variable width character string (8,000 chars)
varchar(size)
To Store Variable width characters (1,073,741,824 chars)
Text
To Store Variable width characters (2GB of text)
nchar
To Store Fixed width Unicode string (4000 chars)
nvarchar
To Store Variable width Unicode string (4000 chars)
nvarchar(size)
To Store Variable width Unicode string (536,870,912 chars)
ntext
To Store Variable width Unicode string (2GB of text)
bit
To Store Integer that can be 0, 1, or NULL
tinyint
To Store whole numbers from 0 to 255
smallint
To Store whole numbers between -32,768 and 32,767
int
To Store whole numbers between
-2,147,483,648 and 2,147,483,647
bigint
To Store whole numbers between
-9,223,372,036,854,775,808 and 9,223,372,036,854,775,807
decimal(total-digits, decimal-precision)

Total Digits: 1 to 38
To Store Fixed precision numbers
From -10^38 +1 to 10^38 –1.
numeric(total-digits, decimal-precision)

Total Digits: 1 to 38
To Store fixed precision numbers.
Allows numbers from -10^38 +1 to 10^38 –1.
float(n)
To Store Floating precision number data
From -1.79E + 308 to 1.79E + 308.
The default value of parameter n is 53 will hold 8 bytes data.
date
To Store a date From January 1, 0001 to December 31, 9999
time
To Store a time has accuracy of 100 nanoseconds
smalldatetime
To store date From January 1, 1900 to June 6, 2079
datetime
To store date From January 1, 1753 to December 31, 9999
timestamp
To store a unique number that gets updated every time a row gets created or modified. Timestamp can be used as a primary key in some occasions. But defining primary key explicitly is recommended.

No comments:

Post a Comment