RIGHT (TSQL Function)

Returns the right part of a string, which length is at most the specified length.

Syntax

RIGHT ( string_expression , length )

Arguments

string_expression
is a string expression of type varchar.
length
is an integer expression of type int. It must be >= 0.

Return Types

Returns varchar.

Examples

PRINT RIGHT('Il était une fois.', 5);
PRINT RIGHT('Il était une fois.', 100);

The result is:

fois.
Il était une fois.
RSQL, a simple alternative to Microsoft SQL Server