dcsimg
 

Submitted by: Hannes du Preez(ojdupreez1978@gmail.com)

Thursday Apr 12th 2018 by Hannes du Preez

Language: SQL, Expertise: Beginner - This query checks for null values, as well as empty strings, then provides a suitable replacement on either occasion.

You may need to check address fields (for example) for a NULL value or an empty string (the value looks null, but simply contains an empty string - which is still technically a value).

The query below checks for null values, as well as empty strings, then provides a suitable replacement on either occasion.

SELECT  TABLE.ID, 
            ISNULL(NULLIF(TABLE.Address, ''), 'No Address') [Address]
    FROM    [dbo].[TABLE]
Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved