handling null values in calculated columns

Last Post 11 May 2007 09:56 AM by sschmid4. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
sschmid4
New Member
New Member

--
11 May 2007 07:57 AM
I have a table with 15 fields, 4 of which are named FIRST, MIDDLE, LAST, and STATE. I want to create calculated columns which will combine these 4 fields together in various combinations such as FIRSTLASTSTATE or FIRSTMIDDLELAST. The below code works excellently when there are no null values in each of the record's fields. However when any of the fields are null, the entire cell returns a null. How can I ignore the null and just combine the fields that are not null?

select * from EN_MEMBERS
go

alter table EN_MEMBERS
add
FLS as rtrim(FIRST)+rtrim(LAST)+rtrim(STATE)


go
sschmid4
New Member
New Member

--
11 May 2007 09:56 AM
THANK YOU, THIS WORKED PERFECTLY.
You are not authorized to post a reply.

Acceptable Use Policy