The following example returns all contact first names with the characters reversed.
USE AdventureWorks;
GO
SELECT FirstName, REVERSE(FirstName) AS Reverse
FROM Person.Contact
WHERE ContactID < 5
ORDER BY FirstName;
GO
Here is the result set.
FirstName Reverse
-------------- --------------
Catherine enirehtaC
Gustavo ovatsuG
Humberto otrebmuH
Kim miK
(4 row(s) affected)
The following example reverses the characters in a variable.
DECLARE @myvar varchar(10)
SET @myvar = 'sdrawkcaB'
SELECT REVERSE(@myvar) AS Reversed ;
GO
The following example makes an implicit conversion from an int data type into varch data type and then reverses the result.
SELECT REVERSE(1234) AS Reversed ;
GO