Advertisement

07.07.2008 at 08:43AM PDT, ID: 23543734
[x]
Attachment Details

displaying a null value when concatenating value.

Asked by running32 in SQL Query Syntax

I am running the select query below.  the problem is that when I join     tblContact.strLName + ',' + tblContact.strFName + '-' + tblContact.strTitle AS name I get a null value is either strlname, strfname or strtitle is Null.  How can I write it so that if one of the values isnull it still writes out the name.   Thank you

SELECT DISTINCT
                      tblContact.lngContactId, tblContact.strLName, tblContact.strFName, tblContact.strTitle,
                      tblContact.strLName + ',' + tblContact.strFName + '-' + tblContact.strTitle AS name
FROM         tblContactType INNER JOIN
                      tblContact INNER JOIN
                      tblContactClass ON tblContact.lngContactId = tblContactClass.lngContactId ON tblContactType.lngContactType = tblContactClass.lngContactType
WHERE     (tblContact.strLName IS NOT NULL)
ORDER BY tblContact.strLName DESC, tblContact.lngContactIdStart Free Trial
 
Loading Advertisement...
 
[+][-]07.07.2008 at 08:47AM PDT, ID: 21946065

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.07.2008 at 09:52AM PDT, ID: 21946643

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906