Data types in SQL Server
VARCHAR(n)Ā Ā Ā Ā Ā Character string of variable length with maximum length n
VARCHAR(MAX)Ā Ā Character string of variable length with maximum length can exceed 8000 byes
NCHAR(n)Ā Ā Ā Ā Ā Ā Ā Fixed-length Unicode string data where n defines the string length and must be a value from 1 through 4,000
NVARCHAR(n)Ā Ā Ā Ā Variable length Unicode string data where n defines the string length and must be a value from 1 through 4,000
NVARCHAR(MAX)Ā Variable length Unicode string data where MAX indicates that the maximum storage size is 2^31-1 bytes (2 GB)
BINARY(n) Ā Ā Ā Ā Ā Binary string of fixed length n
BOOLEAN Ā Ā Ā Ā Ā Ā It stores TRUE or FALSE values
VARBINARY(n)Ā Ā Binary string of variable length with maximum length n
NTEXTĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Variable-length Unicode data with a maximum string length of 2^30 – 1 (1,073,741,823) bytes
TEXTĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Variable-length non-Unicode data in the code page of the server and with a maximum string length of 2^31-1 Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā (2,147,483,647)
IMAGEĀ Ā Ā Ā Ā Ā Ā Ā Ā Variable-length binary data from 0 through 2^31-1 Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā (2,147,483,647) bytes.
INTEGER Or IntĀ Ā A 32-bit signed integer value having range of INTEGER is Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -2147483648 to 2147483647
SMALLINTĀ Ā Ā Ā Ā Ā A 16-bit signed integer value having range of SMALLINT is Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -32768 to 32767.
BIGINTĀ Ā Ā Ā Ā Ā Ā Ā A 64-bit signed integer value having range of BIGINT is Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -9223372036854775808 to 9223372036854775807
DECIMAL(p,s)Ā Ā Ā Exact numerical, precision p, scale s. For Example, Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Decimal(5,3) means 22.212
NUMERIC(p,s)Ā Ā Exact numerical, precision p, scale s. (Same as DECIMAL)
REALĀ Ā Ā Ā Ā Ā Ā Ā Ā Approximate numerical, mantissa precision 7
FLOAT Ā Ā Ā Ā Ā Ā Ā Ā Approximate numerical, mantissa precision 16
DOUBLEĀ Ā Ā Ā Ā Ā Ā Approximate numerical, mantissa precision 16
DATEĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā It stores year/month/day values
TIME Ā Ā Ā Ā Ā Ā Ā Ā Ā It stores hour/minute/second values
TIMESTAMPĀ Ā Ā Ā It stores year/month/day/hour/minute/second values
XMLĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā It stores XML data
Discover more from Technology with Vivek Johari
Subscribe to get the latest posts sent to your email.


