March 14, 2006 at 9:10 am
I'm trying to compress my last and first names so they look good on my report without big gaps. Is there a way to trim the trailing spaces after my last name field?
desired output:
ex: last_name, first_name
I've tried to substring it, right, left commands
March 14, 2006 at 9:16 am
It should be as easy as:
select
rtrim(t.last_name) + ', ' + rtrim(t.first_name) as name
from table t
If that doesn't work the way you want, post your SQL, the output and information about the front-end software in use.
March 14, 2006 at 9:20 am
I'd go a bit further:
select
ltrim(rtrim(t.last_name) )+ ', ' + ltrim(rtrim(t.first_name)) as name
from table t
and even further:
DO ALL TRIMING Client side before it gets into the DB!!
Cheers,
* Noel
March 14, 2006 at 9:21 am
Damn, you guys are quick. By the time I figured it out, I had 2 great replies. Thanks!!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply