RIGHT (Transact-SQL)
SQL Server 2008 R2
Returns the right part of a character string with the specified number of characters.
Compatibility levels can affect return values. For more information, see sp_dbcmptlevel (Transact-SQL).
The following example returns the five rightmost characters of the first name for each contact.
USE AdventureWorks2008R2; GO 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
Rob
berto
Terri
(4 row(s) affected)
