Dropping records

I have this statement but if the ee does not have a middle name, the field comes up null.  How can I correct please to not drop the null records:

DrvName

    = MAX(RTRIM(NameLast) + ', ' + RTRIM(NameFirst) + LEFT(NameMiddle,1) + '.'),

February 5th, 2015 10:48pm

Hi,

Try wrap the column with a COALESCE e.g.

DrvName

    = MAX(RTRIM(NameLast) + ', ' + RTRIM(NameFirst) + LEFT(COALESCE(NameMiddle,''),1) + '.'),

Free Windows Admin Tool Kit Click here and download it now
February 5th, 2015 11:49pm

ISNULL(RTRIM(NameLast),'') + ', ' + ISNULL(RTRIM(NameFirst),'') + ISNULL(LEFT(NameMiddle,1) + '.'),'') 

--Or
CONCAT(RTRIM(NameLast) , ', ' , RTRIM(NameFirst) , LEFT(NameMiddle,1) + '.') 

February 5th, 2015 11:55pm

this

= MAX(RTRIM(NameLast) + COALESCE(', ' + RTRIM(NameFirst),'') + COALESCE(LEFT(COALESCE(NameMiddle,''),1) + '.','')),

Free Windows Admin Tool Kit Click here and download it now
February 6th, 2015 12:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics