SQL Data Types
Overview
This page provides a comprehensive overview of the data types available in SQL Server. Data types define the kind of values that a column in a table can hold. Choosing the appropriate data type is crucial for efficient data storage and accurate results.
Data Type Categories
SQL data types can be broadly categorized into the following:
- Numeric Types: These types store numerical values.
- String Types: These types store textual data.
- Date and Time Types: These types store date and time values.
- Boolean Type: This type represents truth values (TRUE or FALSE).
Numeric Data Types
Some of the common numeric data types include:
INT
BIGINT
SMALLINT
TINYINT
DECIMAL
FLOAT
REAL
String Data Types
Common string data types:
VARCHAR(n)
NVARCHAR(n)
CHAR(n)
NCHAR(n)
Date and Time Data Types
Date and time data types:
DATETIME2
DATETIME
DATE
TIME
DATETIMEOFFSET
Boolean Data Type
The BOOLEAN
data type represents a truth value, which can be either TRUE
or FALSE
.