Saturday, February 16, 2013

Reverse String Function in SQL Server

Reverse String Function in SQL Server


Reverse String function reverses the order of the sequence.

Reverse ASCII chars and UNICODE chars
select reverse('hello world!'),reverse('!dlrow olleh'),reverse(N' हिन्दी')

O/P:

!dlrow olleh    hello world!    ीद्निह

'hello world'  reversed to  !dlrow olleh
 '!dlrow olleh'  reversed to hello world
'हिन्दी'   reversed to ' ीद्निह'


Ex2:  Reverse Column String

select reverse(shipcountry) from orders

O/P: kramneD
dnalreztiwS
ecnarF
ASU


Tags: Reverse String Function in SQL Server,  Reverse Column in sql server

No comments:

Post a Comment