Teradata LPAD - Left Padding

access_time 15 days ago visibility10 comment 0

Teradata LPAD function is used to add repeated characters at the beginning of a string to increase the string to a specified length. It can be used to add leading space or zeros to a string.

LPAD function signature 

LPAD(source_string, length, fill_string)

Returns the source_string padded to the left with the characters in fill_string so that the resulting string is length characters. 

Pad with leading zeros

SELECT LPAD('123456789',23,'0');

Result:

00000000000000123456789

Omit fill_string parameter

The last parameter is optional. When it is omitted, the default value is space (' ')

Example:

SELECT LPAD('123456789',23);

Result:

              123456789
info Last modified by Administrator at 15 days ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

local_offer teradata local_offer SQL

visibility 3
thumb_up 0
access_time 1 day ago

Teradata has no built-in MD5 function thus custom function needs to be implemented for calculating MD5. This article shows you how to do that using the MD5 message digest UDF provided on Teradata Downloads. Prerequisites Permission CREATE FUNCTION is required for creating UDF in Ter...

local_offer teradata local_offer SQL local_offer teradata-sql-query

visibility 16
thumb_up 0
access_time 22 days ago

JSON data type is supported in Teradata from version 15.10. Together with native JSON type, a number of JSON functions are added to support extracting values from JSON, shredding JSON, etc.  info The following code snippets use string l...

local_offer teradata local_offer SQL

visibility 7
thumb_up 0
access_time 1 day ago

A procedure contains a number of SQL statements that will be executed in sequence in Teradata. Procedures can be used to return result sets to the invoking clients. In many other databases, it is very easy to return set records to the client in a procedure as SELECT statement can be directly used...

About column

Teradata

Tutorials and information about Teradata.

rss_feed Subscribe RSS