Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Prepends padding to a string on the left to a specified length.
Syntax
lpad(<string>, <length> [, fill])
Arguments
Required
<string>: The string to pad.<length>: The desired total length.
Optional
fill: The padding characters. Defaults to space.
Returns
Returns a text value padded to the specified length.
Considerations
- If the string is longer than the specified length, it is truncated on the right.
- The fill string is repeated as needed.
Examples
Left Pad
Pad a string on the left.
SELECT lpad('hi', 5, 'xy') AS result;
Returns 'xyxhi'.