right

Returns the part of the character or binary expression starting at the specified number of characters from the right. Return value has the same datatype as the character expression.

Syntax

right(expression, integer_expr)

Parameters

Examples

Usage

  • right, a string function, returns the specified number of characters from the rightmost part of the character or binary expression.

  • If the specified rightmost part begins with the second surrogate of a pair (the low surrogate), the return value starts with the next full character. Therefore, one less character is returned.

  • The return value has the same datatype as the character or binary expression.

  • If expression is NULL, right returns NULL.

See also Transact-SQL Users Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension

Permissions

Any user can execute right.

Related reference
rtrim
substring