Everything you need to get
your projects done.

SQL REVERSE Function

REVERSE returns the specified string value in reversed order.

If the input value is not in string, it will be explicitly cast to string.

Example

#

The example returns a the input string in reverse order..

SELECT REVERSE('Reverse') as 'Reverse',
       REVERSE(12345) as '12345',
       REVERSE('level') as 'level'
Result:  1 record
Reverse 12345 level
esreveR 54321 level

Syntax

Syntax of the REVERSE function.

REVERSE(string)

string -- the string to be reversed.


More Examples

REVERSE with Column

CUSTOMER
Id
FirstName
LastName
City
Country
Phone
Problem: List customer's first names and reversed first names.
SELECT FirstName, REVERSE(FirstName) 
       AS 'Reversed Name'
  FROM Customer
Result:  92 records
FirstName Reversed Name
Paolo oloaP
Pedro ordeP
Marias sairaM
Kyle elyK
Miguel leugiM

You may also like




Guides


vsn 3.1