Mark Leder wrote:
> I'm using this cfquery to pull records from an MSSQL 2005 db:
> 
> SELECT U.userID, U.userFirstName, U.userMiddleName, U.userLastName,
> (U.userFirstName + SPACE(1) + U.userMiddleName + SPACE(1) + U.userLastName)
> AS assignedName  
>    FROM a_Table 
> 
> It works great, with one exception. In some cases, the U.userMiddleName
> datafield is a NULL value.  When that occurs, the entire "assignedName"
> alias is NULL for that record row, not just inserting an empty space between
> the first and last names as I would expect.  When all three datafields
> (first,middle,last) have values, a valid "assignedName" is returned.  Is
> there a workaround?

Use COALESCE around the fields you are concatenating...
COALESCE(U.userMiddleName + SPACE(1),'')

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263914
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to