Returns the right part of a character string with the specified number of characters.
Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.
When using SC collations, the RIGHT function counts a UTF-16 surrogate pair as a single character. For more information, see Collation and Unicode Support.
The following example returns the five rightmost characters of the first name for each person in the AdventureWorks2012 database.
SELECT RIGHT(FirstName, 5) AS 'First Name' FROM Person.Person WHERE BusinessEntityID < 5 ORDER BY FirstName; GO
Here is the result set.
First Name ---------- Ken Terri berto Rob (4 row(s) affected)