- ⌂ Text
- Functions
LPAD()
Return the string argument, left-padded with a specified string.
Prototype
int LPAD(string str, int length, string padstr)
Parameters
- str - Original string to left-pad.
- length - Length of final string to be returned, left-padding padstr as needed.
- padstr - String to left-pad str with to reach the desired length.
Return
Returns the string str
, left-padded with the string padstr
to a length of length
characters. If str
is longer than length
, the return value is shortened to length
characters. The padstr will be repeated and potentially cut-off until the final string is length characters.
Example
SELECT OID, LPAD(Username, 20, '-') AS PaddedUsername FROM User