PadString Function
The PadString() adds number of time a given character if length of original string (first parameter) does not exceed second parameter).
The function takes three (3) to four (4) arguments and returns string with requested length. It will create a new string that consists of an original string
that is padded with leading or trailing characters to a specified total length. The Function uses white space as the padding character if string is more than one character long.
The syntax for PadString function is PadString( String, Length , Character , [ optional 1 to pad right side ] ).
/* Following will produce XXXXXHello */
SELECT PadString('Hello', 10, 'X', 0) ;
/* Following will produce HelloXXXXX */
SELECT PadString('Hello', 10, 'X', 1) ;
/* Following will produce 0010 */
SELECT PadString(10, 4, '0') ;
/* Following will produce 1000 adds two zeros to make length 4 */
SELECT PadString(10, 4, '0', 1) ;