Re: Select without blank spaces



Hugo, Of course, your answer makes more logical sense than mine. - RLF

"Hugo Kornelis" <hugo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:t7b7h3t6bvmmt49f6qr503c9h70744foa3@xxxxxxxxxx
On Mon, 15 Oct 2007 07:29:05 -0700, Ryan Mcbee wrote:

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"?

Hi Ryan,

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

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis


.



Relevant Pages

  • Re: Select Expression Operators
    ... Thanks Hugo. ... >>Sorry for what must seem like a dumb question, but I was wondering why I keep ... > SQL Server doesn't offer the same set of functions as Access and it ... > ISNULL will return the second expression if the first is NULL. ...
    (microsoft.public.sqlserver.mseq)
  • Re: using a trigger to enforce referential integrity
    ... You the man, Hugo!!! ... > When I have to mimic other users on my dev system, I use SQL Server ... This requires setting the SQL Server authentication mode ... > authentication and provide the login name and password for the test user. ...
    (microsoft.public.sqlserver.programming)
  • Re: percentages of top 10 tallies
    ... Hugo is using what is called a derived table. ... Columnist, SQL Server Professional ... My solution uses less IO and yours has the lowest query cost. ... >Hi Tom, ...
    (microsoft.public.sqlserver.programming)
  • Re: Problem with nested function call (UDFs)
    ... However, in SQL Server 2000, it doesn't work. ... the odd behaviour on that platform. ... FROM (SELECT 1, CAST('20070701' AS datetime) ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: Lame Question...
    ... Tibor Karaszi, SQL Server MVP ... > Hugo, many thanks - exactly what I was looking for. ... >>>to extract a column value within the stored procedure. ...
    (microsoft.public.sqlserver.programming)