Groups | Blog | Home
all groups > sql server mseq > october 2007 >

sql server mseq : Select without blank spaces



Ryan Mcbee
10/15/2007 7:29:05 AM
I am writing a query in which I want to select a field and not have the
trailing blank spaces. Here is my query: select employid, lastname + ',' +
frstname as name from upr00100

The results look like this "West ,Paul" or "Mcbee
,Ryan"

How can I get results to look like "West,Paul" or "McBee,Ryan"?

Thanks,
Russell Fields
10/15/2007 11:11:44 AM
Ryan

SELECT employeeid, REPLACE(lastname+','+firstname,SPACE(1),'') as name
FROM upr00100

RLF


[quoted text, click to view]

Russell Fields
10/15/2007 2:51:08 PM
Hugo, Of course, your answer makes more logical sense than mine. - RLF

[quoted text, click to view]

Hugo Kornelis
10/15/2007 8:11:16 PM
[quoted text, click to view]

Hi Ryan,

SELECT employeeid, RTRIM(lastname) + ',' + firstname AS name
FROM upr00100;

--
Hugo Kornelis, SQL Server MVP
AddThis Social Bookmark Button