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.
More Database & SQL Tools
View all 20SQL 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
- Search for a type name or keyword.
- 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 need | Use | Note |
|---|---|---|
| Text in any language | nvarchar(n) / nvarchar(max) | Unicode; plain varchar depends on the collation |
| Auto-incrementing ID | int IDENTITY(1,1) or bigint IDENTITY | Use bigint for tables that may pass 2 billion rows |
| GUID | uniqueidentifier | Use NEWSEQUENTIALID() as a default to reduce index fragmentation |
| Money | decimal(12,2) | Exact, and more portable than the money type |
| Date and time | datetime2 or datetimeoffset | Prefer over the older datetime |
| JSON | nvarchar(max) + ISJSON() check | A 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
nvarcharcolumns need theNprefix -N'नमस्ते'- or non-Latin characters turn into question marks. nvarchar(n)counts in byte-pairs, sonvarchar(4000)is the largest size before you needmax.
Compare with the PostgreSQL and MySQL references.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.