REVERSE function [String]

Function

Takes one argument as an input of type BINARY or STRING and returns the specified string with characters listed in reverse order.

Syntax

REVERSE ( expression | uchar_expr )

Parameters

expression is a character or binary-type column name, variable, or constant expression of CHAR, VARCHAR, NCHAR, NVARCHAR, BINARY, or VARBINARY type.

Example 1

select reverse("abcd")
----
dcba

Example 2

select reverse(0x12345000)
----------
0x00503412

Usage

Permissions

Any user can execute REVERSE.

Standards and compatibility

ANSI SQL – Compliance level: Transact-SQL extension

See also

Functions “LOWER function [String]” and “UPPER function [String]”.

For general information about string functions, see “String functions”.