In this post explains how to use the RIGHT function in SQL Server (Transact-SQL) with syntax and examples.
In SQL Server (Transact-SQL), the RIGHT function allows you to extract a substring from a string, starting from the right-most character.
The syntax for the RIGHT function in SQL Server (Transact-SQL) is:
RIGHT( string, number_of_characters )
The string that you wish to extract from.
The number of characters that you wish to extract starting from the right-most character.
The RIGHT function can be used in the following versions of SQL Server (Transact-SQL):
Let's look at some SQL Server RIGHT function examples and explore how to use the RIGHT function in SQL Server (Transact-SQL).
For example:
SELECT RIGHT('AODBA.com', 9);
Output: 'AODBA.com'
SELECT RIGHT('AODBA.com', 4);
Output: '.com'
SELECT RIGHT('AO dba', 4);
Output: ' dba'