SELECT ISNULL(CAST(NULL as int), '-')
SELECT ISNULL(CAST(NULL as int), '/')
Server: Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value '/' to data type int.
To explain the above one must to remember that:
- ISNULL returns the same type as the check expression (that's the 1st parameter),
- varchar and char data types can be implicitly converted to int (if you don't know what it means, try executing SELECT 2 + '2'),
- SQL Server treats '+' and '-' characters as a number - 0.