RPAD

All functions > STRING > RPAD

Right pads a string to a specified length with a padding string.

Syntax

RPAD(expr, length, pad)
sql

Arguments

ParameterTypeRequiredDescription
stringVARCHARYesString to pad
lengthBIGINTYesTarget length for the result
paddingVARCHARYesString to use for padding

Returns

String padded on the right to the specified length

Notes

  • If string is already longer than length, it is truncated from the right
  • Padding string is repeated as needed
  • If padding string is longer than needed, only part of it is used

Examples

Last update at: 2025/10/13 10:23:46