Data type precedence checker
When T-SQL compares, joins, or combines two different data types, the lower-precedence one gets implicitly converted to match the higher-precedence one — regardless of which side of the expression it's on. Pick two types below to see which one wins.
nvarcharwinsvarchargets convertedPrecedence rank 26 beats rank 28 (1 = highest). Every varchar value involved in this comparison is implicitly converted to nvarchar before the comparison runs.
CONVERT, which usually turns a seek into a scan. Full explanation.Why this matters more than it looks
This isn't just trivia — it's the mechanism behind one of the most common real-world T-SQL performance bugs. If a column is the lower-precedence side of a comparison, SQL Server converts the column's values (not the other side), which usually makes an index on that column unusable — a seek silently becomes a scan, with no error to flag it. The single most common trigger: ADO.NET and most ORMs default a plain string parameter to NVARCHAR, so comparing it against a VARCHAR column hits this on every call. Full explanation, with the exact plan predicate to look for →
The full precedence order
Highest to lowest. Length/precision (varchar(50) vs varchar(200)) never affects this — only the base type does.
- 1
json - 2
sql_variant - 3
xml - 4
user-defined type - 5
datetimeoffset - 6
datetime2 - 7
datetime - 8
smalldatetime - 9
date - 10
time - 11
float - 12
real - 13
decimal - 14
money - 15
smallmoney - 16
bigint - 17
int - 18
smallint - 19
tinyint - 20
bit - 21
ntext - 22
text - 23
image - 24
timestamp - 25
uniqueidentifier - 26
nvarchar - 27
nchar - 28
varchar - 29
char - 30
vector - 31
varbinary - 32
binary
hierarchyid</code>, <code>geometry</code>, <code>geography all rank above the string and binary types above, but Microsoft doesn't publish their exact position relative to the numeric/date types or to each other.
Source: Microsoft's Data Type Precedence documentation. This list reflects the current published order — Microsoft has changed it before (adding json and vector), so re-check against the source if this page is old.