Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenate name

Status
Not open for further replies.

crystal2770

Technical User
Jan 8, 2008
13
US
Im sure its easy but I cant find the way to do this..
I am trying to concatenate the name in my select statement..

b.lst_nm+', '+b.fst_nm

HOWEVEr all this gives me is..

NAME ,FIRST
NAMELLL ,FIRSTTTT

I need the following at a fixed with of 32
NAME, FIRST
NAMELLL, FIRSTTTT

Thanks
 
How is the "32" distributed between the first and last names? Or do you just need the result to be padded to 32 characters?

Since it appears that your name fields are char(), trim the trailing spaces from the fields, and add spaces using the SPACE() function. (But note this entry from BOL: "To include spaces in Unicode data, use REPLICATE instead of SPACE.")

HTH,

Phil H.
-----------
A virtual machine ate my accounting data. I transferred it to a physical box, then I beat it to smithereens with a sledgehammer. I feel better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top