Problem with sql column formula -- null / concat


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Problem with sql column formula -- null / concat

  1. #1
    Join Date
    Jan 2007
    Posts
    39

    Problem with sql column formula -- null / concat

    I've got the folowing formula for a computed column (LeadFullName) in the database design portion of vs2003.

    ([LeadFirstName] + ' ' + [LeadMidInitial] + ' ' + [LeadLastName])

    Unfortuantely, Lead middle initial was added as a new column, so is null for all existing records. So all the existing records with null middle names show LeadFullName as null. I understand there are various ways to fix this, but I'm not sure how to implement in a formula.



    Any help would be appreciated

    Randy

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try this:

    ([LeadFirstName] + ' ' + COALESCE([LeadMidInitial], '') + ' ' + [LeadLastName])
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jan 2007
    Posts
    39

    Success - Problem with sql column formula -- null / concat

    Phil,

    It worked perfectly! I had searched all over the internet, and only come up with ws_concat (which I couldn't get to work) and ifnull logic (that seemed pretty complex.

    Thanks for the quick, Sunday reply!

    Randy

Similar Threads

  1. need help with xml problem
    By Guillermo Hidalgo in forum XML
    Replies: 2
    Last Post: 05-22-2002, 04:49 AM
  2. SQL timestamp column in XML
    By Randy Williams in forum XML
    Replies: 2
    Last Post: 05-25-2001, 08:03 AM
  3. SQL server administrative knowledge
    By Becky in forum Database
    Replies: 1
    Last Post: 07-11-2000, 04:27 PM
  4. Re: ODBC error
    By Devaraj in forum Enterprise
    Replies: 0
    Last Post: 05-11-2000, 01:48 PM
  5. Multi-row calculations
    By Bob Hines in forum Database
    Replies: 7
    Last Post: 04-27-2000, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center