Skip to content
Advertisement

Why does this conversion to date fail on some rows in my table and not other rows when I use an IIF

I have this table and data:

This script works:

This script fails:

Msg 241, Level 16, State 1
Conversion failed when converting date and/or time from character string.

Advertisement

Answer

You could use try_convert with a cross apply

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement