Excel → T-SQL › IFERROR

IFERROR to TRY_CONVERT / ISNULL

IFERROR is “if this blows up, use that.” In T-SQL the blow-up is a convert or a missing join.

ISNULL(TRY_CONVERT(int, raw_code), 0)

TRY_CONVERT returns NULL on junk. ISNULL turns that into your fallback. Do not use CONVERT alone on dirty client files.

Canonical translation

ISNULL(TRY_CONVERT(int, raw_code), 0)

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free