×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Concatenating Fields Using Double Bars

Concatenating Fields Using Double Bars

Concatenating Fields Using Double Bars

(OP)
Greetings! I'm working with a CASE statement to concatenate two different address fields together. The field "Alternate Line 1" contains the customers address and "Alternate Line 2" contains the apartment number to the address that's contained in "Alternate Line 1". However, when I run the below code, the results places a huge space between the address and the apartment number, and I'm only wanting there to be just one space between them.

CODE -->

CASE WHEN SUBSTR(Customer_Address.Alternate_Line_1,1,1) IN('1','2','3','4','5','6','7','8','9') THEN (Customer_Address.Alternate_Line_1 ||''|| Customer_Address.Alternate_Line_2) 

I'm wondering if it might be due to a conversion error that's taking place when the query is being run. Aside from that guess, I'm pretty much at a loss as to where I'm going wrong.

Thank you kindly! bigsmile

RE: Concatenating Fields Using Double Bars

Hi,

Try Trim. It’s been a long time since I’ve coded DB2 SQL, so you might be limited to LTrim or RTrim...

CODE

(Trim(Customer_Address.Alternate_Line_1) ||''|| Trim(Customer_Address.Alternate_Line_2)) 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Concatenating Fields Using Double Bars

(OP)
That seemed to do the trick, THANK YOU!

RE: Concatenating Fields Using Double Bars

Just a dash of a Tip. 😉

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close