The SQL REVERSE is one of the String Functions used to reverse the specified expression, and its syntax is

SELECT REVERSE (String_Expression)
FROM [Source]

We are going to use the below-shown data to explain the SQL Server string REVERSE Function.

Employee Table

SQL REVERSE Function Example

The REVERSE function is used to invert the given string. The following query will show multiple ways to use it.

We first declared a string variable within this query and assigned the string data. Next, we used the String method to reverse the string variable @String_Expression. In the next line, we used it directly on the string.

DECLARE @String_Expression varchar(50)
SET @String_Expression = 'SQL Server'

SELECT REVERSE (@String_Expression) AS 'SQLReverse' 

SELECT REVERSE ('SQL Server 2014') AS 'SQLReverse'
REVERSE Example 1

The reverse function also allows you to reverse the expressions inside the columns. In this Server example, We are going to reverse all the records in the [Department Name] column present in the Employee table.

SELECT [FirstName]
      ,REVERSE ([DepartmentName]) AS [SQLReverse]
 FROM [Employe]

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.