REVERSE (T-SQL)

Returns the reverse of a character expression.

Syntax

REVERSE(character_expression)

Arguments
character_expression
Is an expression of character data. character_expression can be a constant, variable, or column of either character or binary data.
Return Types

varchar

Remarks

character_expression must be of a data type that is implicitly convertible to varchar. Otherwise, use CAST to explicitly convert character_expression.

Examples

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)

  

See Also
CAST and CONVERT String Functions
Data Types  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.