How To Check If SQL Server Column Is Null Or Empty
Hello fellow programmers!
Here's a simple T-SQL statement that will check if a column value is null or empty.
First, it will check if the field is null. If true, it will return empty string. Else, another checking will be performed and this time if it's an empty string. If not an empty string, show the column value. Else show an empty string.
That's it! :-)
Here's a simple T-SQL statement that will check if a column value is null or empty.
IIF(c.BillPhone is null, '', IIF(Len(c.BillPhone) > 0, c.BillPhone ,'')) as BillingPhone
That's it! :-)
Comments
Post a Comment