REVERSE
returns the specified string value in reversed order.
If the input value is not in string, it will be explicitly cast to string.
The example returns a the input string in reverse order..
SELECT REVERSE('Reverse') as 'Reverse',
REVERSE(12345) as '12345',
REVERSE('level') as 'level'
Reverse | 12345 | level |
---|---|---|
esreveR | 54321 | level |
Syntax of the REVERSE function.
REVERSE(string)
string
-- the string to be reversed.
CUSTOMER |
---|
Id |
FirstName |
LastName |
City |
Country |
Phone |
SELECT FirstName, REVERSE(FirstName)
AS 'Reversed Name'
FROM Customer
FirstName | Reversed Name |
---|---|
Paolo | oloaP |
Pedro | ordeP |
Marias | sairaM |
Kyle | elyK |
Miguel | leugiM |