Returns the reverse of a character expression.
REVERSE(character_expression)
varchar
character_expression must be of a data type that is implicitly convertible to varchar. Otherwise, use CAST to explicitly convert character_expression.
This example returns all author first names with the characters reversed.
USE pubs
GO
SELECT REVERSE(au_fname)
FROM authors
ORDER BY au_fname
GO
Here is the result set:
--------------------
maharbA
okikA
treblA
nnA
ennA
truB
enelrahC
lyrehC
naeD
kriD
rehtaeH
sennI
nosnhoJ
aiviL
eirojraM
rednaeM
leahciM
lehciM
ratsgninroM
dlanigeR
lyrehS
snraetS
aivlyS
(23 row(s) affected)
CAST and CONVERT | String Functions |
Data Types |