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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 reverse non-english string
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

400 Posts

Posted - 09/29/2013 :  13:56:53  Show Profile  Reply with Quote

I have a string in Hebrew that is reversed such as 'tac god (435)'
I want the result to be 'cat dog (435)'
I want it to reverse only the chars and not the numbers.

How can this be done?


James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 09/29/2013 :  17:07:51  Show Profile  Reply with Quote
If you can find a consistent separator, then you can do like shown below. In the example below, I am using '(' as the separator. It needs a little refinement - the space before the '(' is also part of the reverse in this example:
declare @x varchar(32) = 'tac god (435)';
select reverse(left(@x,charindex('(',@x+'(')-1)) 
	+ stuff(@x,1,charindex('(',@x+'(')-1,'');
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000