Sitemap
seyma akın

seyma akın

SQL Server Data Types

1 min readJul 4, 2025

--

In SQL Server, every column must have a name and a data type.
The data type defines what kind of data can be stored in that column.

SQL Server groups data types into 3 main categories:
String, Numeric, Date & Time

1. String Data Types

Used for storing text, letters, numbers, and symbols.

CHAR(n)Fixed-length text. Always uses n characters. Good for things like postal codes.

VARCHAR(n)Variable-length text. Only uses space needed. Best for names, emails, etc.

VARCHAR(MAX)For very long text (e.g. blog content).

NCHAR(n)Like CHAR, but supports Unicode (multi-language).

NVARCHAR(n)Like VARCHAR, but for Unicode.NVARCHAR(MAX)Unicode + long text.

TEXT, NTEXTOld types for long text. Don’t use — they’re deprecated.

2. Numeric Data Types

BIT0 or 1 (like True/False).TINYINTSmall number (0–255).

SMALLINTMedium-small number.

INTMost common integer (-2B to +2B).

BIGINTVery big number.

DECIMAL(p,s)Exact numbers with decimals. Best for money. (p = total digits, s = digits after decimal)

Get seyma akın’s stories in your inbox

Join Medium for free to get updates from this writer.

NUMERIC(p,s)Same as DECIMAL.

FLOATDecimal with floating precision (less accurate).

REALSmaller version of FLOAT.

MONEYFor prices (4 decimal places, big range).

SMALLMONEYFor smaller prices.

3. Date & Time Data Types

Used to store dates, times, or both.

DATEOnly the date (YYYY-MM-DD).

TIMEOnly the time (hh:mm:ss).

DATETIMEDate + time. (Good default choice.)

SMALLDATETIMELess precise than DATETIME.

DATETIME2Better and more accurate version of DATETIME.

DATETIMEOFFSETLike DATETIME2, but includes time zone.

Tips

  • Use VARCHAR(MAX) or NVARCHAR(MAX) for long text.
  • Don’t use TEXT, NTEXT, or IMAGE — they’re outdated.
  • Use BIT for yes/no or true/false.
  • Use DECIMAL for anything that needs precision (like money).

--

--