Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi,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?Thanks
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2013-09-29 : 17:07:51
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,'');