SQL Flow Field Guide

RIGHT

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

string transform

What changes

Input
string arguments
Output or change
string or integer
Return type
Returns varchar when character_expression is a non-Unicode character data type. Returns nvarchar when character_expression is a Unicode character data type.

Syntax at a glance

RIGHT ( character_expression , integer_expression )

Work example

Read a suffix such as a short extension or code segment.

Validate the source length before treating a suffix as a complete identifier.

Check your work RIGHT counts characters and does not validate the meaning of the returned suffix.

Practice SQL

Open in SQL Flow
SELECT RIGHT('INV-2048', 4) AS suffix;

Open Microsoft Learn for full syntax, permissions, and details for your version.