if((isnull(@value,''))='')
I want to know whether the above piece of code works in checking if the variable is null or empty.
Yes, that code does exactly that.
You can also use:
if (@value is null or @value = '')
With the added information that @value is an int value, you need instead:
if (@value is null)
An int value can never contain the value ''.
len function returns zero, not null.Use This way is Better
if LEN(ISNULL(@Value,''))=0
This check the field is empty or NULL
Yes, you could also use COALESCE(@value,'')='' which is based on the ANSI SQL standard:
SELECT CASE WHEN COALESCE(@value,'')=''
THEN 'Yes, it is null or empty' ELSE 'No, not null or empty'
END AS IsNullOrEmpty
You can try
<column_name> is null
in the where clause.
@value.INT, so no need to check for that case if the type is reallyINT.