if((isnull(@value,''))='')
I want to know whether the above piece of code works in checking if the variable is null or empty.
You can use the IsNullOrWhiteSpace method to test whether a string is null , its value is String. Empty, or it consists only of white-space characters.
Java String isEmpty() Method The isEmpty() method checks whether a string is empty or not. This method returns true if the string is empty (length() is 0), and false if not.
A string refers to a character's sequence. Sometimes strings can be empty or NULL. The difference is that NULL is used to refer to nothing. However, an empty string is used to point to a unique string with zero length.
“A null String is Java is literally equal to a reserved word “null”. It means the String that does not point to any physical address.” In Java programming language, a “null” String is used to refer to nothing. It also indicates that the String variable is not actually tied to any memory location.
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 ''
.
Use This way is Better
if LEN(ISNULL(@Value,''))=0
This check the field is empty
or NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With