InterSystems SQL Reference
A string function that returns a string right-padded to a specified length.
||A string expression, which can be the name of a column, a string literal, a host variable, or the result of another scalar function. Can be of any data type convertible to a VARCHAR data type. string-expression cannot be a stream.
||An integer specifying the number of characters in the returned string.
||Optional A string consisting of a character or a string of characters used to pad the input string-expression. The padstring character or characters are appended to the right of string-expression to supply as many characters as need to create an output string of length characters. padstring may be a string literal, a column, a host variable, or the result of another scalar function. If omitted, the default is a blank space character.
pads a string expression with trailing pad characters. It returns a copy of the string padded to length
number of characters. If the string expression is longer than length
number of characters, the return string is truncated to length
number of characters.
does not remove leading or trailing blanks; it pads the string including any leading or trailing blanks. To remove leading or trailing blanks before padding a string, use LTRIM
, or TRIM
The following example right pads column values with ^ characters (when needed) to return strings of length 16. Note that some Name strings are right padded, some Name strings are right truncated to return strings of length 16.
SELECT TOP 15 Name,RPAD(Name,16,'^') AS Name16
The following example right pads column values with the ^=^ pad string (when needed) to return strings of length 20. Note that the pad name string is repeated as many times as needed, and that some return strings contain partial pad strings:
SELECT TOP 15 Name,RPAD(Name,20,'^=^') AS Name20
Content Date/Time: 2019-05-14 07:37:13