SQL Server Data Types

SQL Server Tutorials and Syntax
Post Reply
MLinfo
Posts: 1
Joined: Wed Jun 26, 2019 4:14 pm

Wed Jun 26, 2019 4:30 pm

Numeric data types

bit - FROM: 0 TO: 1
tinyint - FROM: 0 TO: 255
smallint - FROM: -32,768 TO: 32,767
int - FROM: -2,147,483,648 TO: 2,147,483,647
bigint - FROM: -9,223,372,036,854,775,808 TO: 9,223,372,036,854,775,807
decimal - FROM: -10^38 +1 TO: 10^38 -1
numeric - FROM: -10^38 +1 TO: 10^38 -1
float - FROM: -1.79E + 308 TO: 1.79E + 308
real - FROM: -3.40E + 38 TO: 3.40E + 38

SQL Date and Time Data Types

DATE: Stores date in the format YYYY-MM-DD
TIME: Stores time in the format HH:MI:SS
DATETIME: Stores date and time information in the format YYYY-MM-DD HH:MI:SS
TIMESTAMP: Stores number of seconds passed since the Unix epoch (‘1970-01-01 00:00:00’ UTC)
YEAR: Stores year in 2 digit or 4 digit format. Range 1901 to 2155 in 4-digit format. Range 70 to 69, representing 1970 to 2069.

SQL Character and String Data Types

CHAR: Fixed length with maximum length of 8,000 characters
VARCHAR: Variable length storage with maximum length of 8,000 characters
VARCHAR(max): Variable length storage with provided max characters, not supported in MySQL
TEXT: Variable length storage with maximum size of 2GB data

SQL Unicode Character and String Data Types

NCHAR: Fixed length with maximum length of 4,000 characters
NVARCHAR: Variable length storage with maximum length of 4,000 characters
NVARCHAR(max): Variable length storage with provided max characters
NTEXT: Variable length storage with maximum size of 1GB data

SQL Binary Data Types

BINARY: Fixed length with maximum length of 8,000 bytes
VARBINARY: Variable length storage with maximum length of 8,000 bytes
VARBINARY(max): Variable length storage with provided max bytes
IMAGE: Variable length storage with maximum size of 2GB binary data

Other / Misc SQL data types

CLOB: Character large objets that can hold up to 2GB
BLOB: For binary large objects
XML: for storing xml data
JSON: for storing JSON data

Please let me know if I have missed any and I will update the list :)
Bob547
Posts: 12
Joined: Sat Jun 22, 2019 7:05 pm

Wed Jun 26, 2019 4:31 pm

Hi @MLinfo DATETIMEOFFSET appears to be missing from the list! :)
Post Reply

Social Media