Skip to main content
Database & SQL Tools

SQL Server Data Type Reference

A searchable reference of SQL Server data types - numeric, character, date/time, binary, uniqueidentifier, and XML.

Search or browse SQL Server's data types by category, including uniqueidentifier and native XML storage.

SQL Server has no standalone native JSON data type - JSON is stored as NVARCHAR text with built-in functions to query it, unlike PostgreSQL's dedicated JSONB type.

What Is This Reference?

A searchable list of SQL Server's data types - numeric, character (including the Unicode-aware NVARCHAR), date/time, binary, the uniqueidentifier (GUID) type, and native XML storage.

Why Use This Tool?

SQL Server's VARCHAR vs NVARCHAR distinction (non-Unicode vs Unicode storage) and its lack of a dedicated JSON type (unlike PostgreSQL) trip up developers coming from other databases. This reference clarifies both.

How to Use It

  1. Search for a type name or keyword.
  2. Review its description and typical use case.

Important Notes

SQL Server does not have a standalone native JSON data type the way PostgreSQL has JSONB - JSON is stored as NVARCHAR text, with built-in functions (JSON_VALUE, JSON_QUERY, OPENJSON) to query it.

Choosing Types: Quick Recommendations

You needUseNote
Text in any languagenvarchar(n) / nvarchar(max)Unicode; plain varchar depends on the collation
Auto-incrementing IDint IDENTITY(1,1) or bigint IDENTITYUse bigint for tables that may pass 2 billion rows
GUIDuniqueidentifierUse NEWSEQUENTIALID() as a default to reduce index fragmentation
Moneydecimal(12,2)Exact, and more portable than the money type
Date and timedatetime2 or datetimeoffsetPrefer over the older datetime
JSONnvarchar(max) + ISJSON() checkA native json type is arriving only in the newest versions

Example Table

CREATE TABLE dbo.Orders (
    Id          bigint IDENTITY(1,1) PRIMARY KEY,
    PublicId    uniqueidentifier NOT NULL DEFAULT NEWSEQUENTIALID(),
    CustomerName nvarchar(200) NOT NULL,
    Total       decimal(12,2) NOT NULL,
    Meta        nvarchar(max) NULL CHECK (ISJSON(Meta) = 1),
    CreatedAt   datetime2 NOT NULL DEFAULT SYSUTCDATETIME()
);

Common Pitfalls

  • String literals for nvarchar columns need the N prefix - N'नमस्ते' - or non-Latin characters turn into question marks.
  • nvarchar(n) counts in byte-pairs, so nvarchar(4000) is the largest size before you need max.

Compare with the PostgreSQL and MySQL references.

Frequently Asked Questions

NVARCHAR stores Unicode text, so use it for names or anything in non-English languages. VARCHAR uses less space but only supports the column's code page (or UTF-8 collations in SQL Server 2019+).

A 16-byte GUID type. It is useful for globally unique IDs, but random GUIDs as a clustered primary key can fragment indexes - consider NEWSEQUENTIALID().

Prefer DATETIME2 for new tables. It has a larger date range, better precision and is aligned with the SQL standard.
Share this tool: