Conversion, Formatting and NULL Functions in T-SQL: CAST/CONVERT Styles, TRY_CONVERT, FORMAT, ISNULL, COALESCE, NULLIF, IIF and CHOOSE
ISNULL converts the result to the first argument's type, COALESCE picks by type precedence: ISNULL(NULL int, 1.5) returns 1. With real output and PostgreSQL counterparts we cover CONVERT style codes, empty strings becoming 0 and 1900-01-01, TRY_PARSE turning 1450.00 into 145,000 under tr-TR, the CPU cost of FORMAT, COALESCE running a subquery twice and the NULL behaviour of GREATEST.
15 Nov 2026
·
15 min
·
11