RIGHT
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 FlowSELECT RIGHT('INV-2048', 4) AS suffix;
Open Microsoft Learn for full syntax, permissions, and details for your version.