I want to have function in sql server similar to ISNULL() except it should check expression for null and empty also.
If first parameter is null or empty, returns second.
can someone help me?
You can use NULLIF
and ISNULL
:
SELECT ISNULL(NULLIF(@parameter, ''), @parameter2)