Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Trim Function

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-07-07 : 06:16:01
hello,
Am trying to remove trailing spaces in my database.

How do i achieve this ? am running the query below to get the first 11 characters, without trailing spaces

insert into afrika
select number =
(case 080
when '080' then '234'+ right(number,10)
end)
from ehioze
select * from afrika


I would like to trim the right(number,10) to omit spaces

thanks
Afrika

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-07 : 06:23:16
use rtrim(number)?

--------------------
keeping it simple...
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-07-07 : 06:32:21
Ok thanks Jen
It works. I was mixed up there
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-07-07 : 07:02:00
it happens sometimes

--------------------
keeping it simple...
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-07-07 : 07:13:19
I had it all mixed up with ASP code

Here's my final code

insert into afrika
select number =
(case 080
when '080' then '234'+ right(rtrim(phone),10)
end)
from ehioze
select * from afrika
Go to Top of Page
   

- Advertisement -