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
 SQL Server Development (2000)
 reversing a string

Author  Topic 

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-04-28 : 06:36:09
Hi,
I want to reverse a string like 'harshal' to 'lahsrah'.
any ideas?
harshal.

Expect the UnExpected

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-04-28 : 06:40:17
quote:

Hi,
I want to reverse a string like 'harshal' to 'lahsrah'.
any ideas?
harshal.

Expect the UnExpected



OK I got it its the functin reverse()

Expect the UnExpected
Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-04-28 : 06:40:39

declare @str varchar(100),
@str2 varchar(100)

select @str='harshal'
select @str2=''

while datalength(@str)>0
begin
select @str2=@str2 + right(@str,1)
select @str=left(@str, datalength(@str)-1)
end

select @str2


Oh shit... There was a function :D


Edited by - andraax on 04/28/2003 06:41:11
Go to Top of Page
   

- Advertisement -