Combine two fields together

  • Hello,

    I am trying to add to fields together and I get space between them,how can I remove the space?

    My results:

    5413 6955016

    I want these 2 values like this:

    54136955016

    Thank you

  • would you please provide the sample data you'd like to concatenate?

    Something like

    SELECT 'abc','def'

    Also, please include your current approach.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • SELECT filed1 + field2 AS 'BU'

    FROM table

    Result

    5413 6955016

  • Since I don't know where the blank is coming from (presumably because Field1 is defined as CHAR(5), but it's also possible that the value of field2 starts with a blank) I added both options:

    SELECT RTRIM(filed1) + LTRIM(field2) AS 'BU'

    FROM table



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Thank you

  • how would I add one space between them?

    Thank you

  • Use your original query????



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I just need one space, I have 13 spaces between them

  • Use

    select field1 + ' ' + field2

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply