SQL SERVER REVERSE

SQL Server REVERSE function is a string function that returns the reverse order of a string value. It returns a value of type varchar or nvarchar .





SYNTAX

REVERSE(input_string )

input_string
input_string can be a constant, variable, or column of either character or binary data.

Lets look at an example of REVERSE() Function in SQL Server.

The following statement implicit conversion from an int data type into varchar data type and then reverses the input string and returns result.

SELECT REVERSE(123456789) AS Reversed;

The following statement reverses the characters in a variable.

DECLARE @string varchar(9); 
SET @string = 'microsfot'; 
SELECT REVERSE(@string) AS Reversed ;

The following statement returns the reverse value for Age column  in a table.

 SELECT Age , REVERSE(Age) AS AgeReversed FROM Person

SQL Server String Functions



FORMAT()

STRING_AGG()

PATINDEX()

QUOTENAME()

CHARINDEX()

LEN()

DATALENGTH()

SUBSTRING()

REPLACE()

REPLICATE()

SQL Basics TutorialSQL Advance TutorialSSRSInterview Q & A
SQL Create tableSQL Server Stored ProcedureCreate a New SSRS Project List Of SQL Server basics to Advance Level Interview Q & A
SQL ALTER TABLESQL Server MergeCreate a Shared Data Source in SSRSSQL Server Question & Answer Quiz
SQL DropSQL Server PivotCreate a SSRS Tabular Report / Detail Report
..... More.... More....More
Power BI TutorialAzure TutorialPython TutorialSQL Server Tips & Tricks
Download and Install Power BI DesktopCreate an Azure storage accountLearn Python & ML Step by stepEnable Dark theme in SQL Server Management studio
Connect Power BI to SQL ServerUpload files to Azure storage containerSQL Server Template Explorer
Create Report ToolTip Pages in Power BICreate Azure SQL Database ServerDisplaying line numbers in Query Editor Window
....More....More....More




 24 total views,  1 views today

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.