NVARCHAR
A variable-length UTF-8 encoded text string. Use NVARCHAR for any text that may contain non-ASCII characters. JSON columns are stored as NVARCHAR.
Example
SELECT 'héllo wörld';Casting
| From | Example | Notes |
|---|---|---|
| from VARCHAR | ascii_col::NVARCHAR |
Validates UTF-8; fails if the bytes are not valid UTF-8 |
| from VARBINARY | bin_col::NVARCHAR |
Interprets raw bytes as UTF-8; fails on invalid sequences |
Comparisons
Can be compared (using =, <, >, etc.) with: NVARCHAR, VARCHAR.
Notes
Supports LIKE, ILIKE, and RLIKE pattern matching. String functions that operate on character positions (e.g. SUBSTRING) count Unicode code points, not bytes.
Limitations
- Casting from VARBINARY will fail if the bytes are not valid UTF-8.
- There is no structured STRUCT or JSONB type. JSON data lands as NVARCHAR — use
->and->>to navigate it.