IsEmpty function like ISNULL in SQL Server? IsEmpty function like ISNULL in SQL Server? sql sql

IsEmpty function like ISNULL in SQL Server?


Please try:

SET @YourValue=ISNULL(NULLIF(@YourValue,' '), NULL)

which returns NULL if value is NULL, empty or space.

Note:NULLIF returns the first expression if the two expressions are not equivalent. If the expressions are equivalent, NULLIF returns a null value of the type of the first expression.


Use SET @SKU = NULLIF(@SKU,'') to set @SKU to null where @SKU equals the value of the second argument.

IsEmpty isn't a built-in T-SQL function, but NULLIF can be used to achieve a similar behavior.