Skip to content
Advertisement

SQL check if Int is null select NVarchar

I want to check if an INT is null, and if so select a different name for the value. But I keep getting a

Conversion failed when converting the varchar value ‘NAME’ to data type int

I want something like..

Simply, if null select the second name, otherwise if it has a value, select the first

Advertisement

Answer

Use a case expression instead:

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