Skip to Content

mvSQL Database Function - LPAD()

Summary

Causes a string to be a given length. If the string is longer than the specified length, it will be truncated. If it is larger, it will be padded to the left with an assigned character.

Syntax

LPAD(<string>, <length>, <padchar>)

Parameters

string

The string to pad.

length

The desired length.

padchar

The character to pad with if the desired length is greater than the current string length.

Returns

A padded string.

Examples

LPAD('HelloWorld', 8, '0')

Returns

HelloWor

LPAD('HelloWorld', 12, '0')

Returns

HelloWorld00