 |
|
 |
|
Next: Expanding the cube browser in SSAS 2005
|
| Author |
Message |
External

Since: May 17, 2007 Posts: 9
|
(Msg. 1) Posted: Mon Oct 15, 2007 7:29 am
Post subject: Select without blank spaces Archived from groups: microsoft>public>sqlserver>mseq (more info?)
|
|
|
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,
Ryan >> Stay informed about: Select without blank spaces |
|
| Back to top |
|
 |  |
External

Since: Feb 21, 2007 Posts: 457
|
(Msg. 2) Posted: Mon Oct 15, 2007 11:11 am
Post subject: Re: Select without blank spaces [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Ryan
SELECT employeeid, REPLACE(lastname+','+firstname,SPACE(1),'') as name
FROM upr00100
RLF
"Ryan Mcbee" wrote in message
>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,
> Ryan >> Stay informed about: Select without blank spaces |
|
| Back to top |
|
 |  |
External

Since: Jan 31, 2006 Posts: 335
|
(Msg. 3) Posted: Mon Oct 15, 2007 8:11 pm
Post subject: Re: Select without blank spaces [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
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 >> Stay informed about: Select without blank spaces |
|
| Back to top |
|
 |  |
External

Since: Feb 21, 2007 Posts: 457
|
(Msg. 4) Posted: Mon Oct 15, 2007 8:11 pm
Post subject: Re: Select without blank spaces [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hugo, Of course, your answer makes more logical sense than mine. - RLF
"Hugo Kornelis" wrote in message
> 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 >> Stay informed about: Select without blank spaces |
|
| Back to top |
|
 |  |
| Related Topics: | Nested select - Can you tell me whats wrong with this query? select count(*) as CountedOrders from ( select distinct [order] from [OrdersTable] where [Customer]='100000' and [Order Date] between '01/01/2005' and '31/12/2005' ) It runs perfect in MS Access but not in...
EXEC (select... ) problem Help! - How can I get this to work? declare @WkEmpID declare @sql varchar(1000) set @sql = 'select distinct @WkEmpID = EmpID from Employee' exec (@sql) Now this is a simplified version of a more comples query which is forcing me to use this method rather than...
GROUP BY's on 3 tables in one SELECT? - Hi there, I'd like to ask you for help with following: having 3 tables: T1 (Person_ID, Product_ID, Costs) T2 (Person_ID, Product_ID, Balancies) T3 (Product_ID, Product_Type) I have simple GROUP BY query: SELECT T1.Person_ID, T1.Product_ID, MAX(Costs)..
How to select all top 1s from different group in a view - Hi SQL Query Guru, I have a view like this: Contract_KEY Step 1 1 1 3 2 1 2 5 2 4 How do I write a query to retrieve the following result: ...
SELECT ~~ OVER(PARTITION BY ~~) in SQL Server 2005? - I'm using VS 2005 with SQL Server 2005 (all are release versions). I read about the new Windows Functions SQL commands in a book, and, using the Query Designer, created a SQL Query against my database that included SELECT COUNT(field1) OVER.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|