Sunday, May 27, 2012

Sql Server:How to reverse a string

Here i will show how to reverse a string using sql function.There is a function "REVERSE" is used to done this task in sql.I declared a string "mystring" then pass the value "bhaskar" to it .The output after will like "raksahb
Syntax:
DECLARE @mystring varchar(50)
SET mystring="Bhaskar"
SELECT REVERSE (@mystring) as ReversedString

No comments:

Bel