Extracts a certain number of characters from the trailing portion of a string value.
Syntax
RIGHT(<StringExpression> FOR <IntegerExpression>)
RIGHT(<StringExpression>, <IntegerExpression>)
<StringExpression> =
Type of:
CHARACTER|CHAR
CHARACTER VARYING|VARCHAR
GUID
CHARACTER LARGE OBJECT|CLOB
Returns
Same as input
UsageThe RIGHT function extracts a certain number of characters from the trailing portion of a string. The FOR parameter specifies the length of the extracted substring. If the FOR parameter is greater than the length of the input string, then the result will be the input string.
Examples
SELECT RIGHT(CustomerID, 6)
FROM Customers
SQL 2003 Standard DeviationsThis function deviates from the SQL 2003 standard in the following ways: