RIGHT (Transact-SQL)
SQL Server 2008
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 AdventureWorks; GO SELECT RIGHT(FirstName, 5) AS 'First Name' FROM Person.Contact WHERE ContactID < 5 ORDER BY FirstName; GO
Here is the result set.
First Name ---------- erine stavo berto Kim (4 row(s) affected)
