Teradata LPAD - Left Padding

access_time 3 months ago visibility153 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 3 months 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

visibility 13760
thumb_up 0
access_time 6 years ago

Infosphere DataStage is adopted as ETL (Extract, Transform, Load) tool in many Teradata based data warehousing projects. With the Teradata ODBC and .NET data providers, you can also use the BI tools from Microsoft, i.e. SSIS. In my previous post, I demonstrated how to install Teradata Toolkit ...

local_offer pyspark local_offer spark-2-x local_offer teradata local_offer SQL Server local_offer spark-database-connect

visibility 7692
thumb_up 1
access_time 9 months ago

In my previous article about  Connect to SQL Server in Spark (PySpark) , I mentioned the ways to read data from SQL Server databases as dataframe using JDBC. We can also use JDBC to write data from Spark dataframe to database tables. In the following sections, I'm going to show you how to ...

local_offer teradata local_offer SQL local_offer teradata-functions

visibility 1335
thumb_up 0
access_time 8 months ago

OREPLACE functions in Teradata can be used to replace or remove characters from a string. OREPACE is Teradata's extension to ASNI SQL. The usual REPLACE function is not available. REPLACE function is commonly implemented in many other SQL databases such as SQL Server, MySQL, BigQuery, Oracle, etc.

About column

Tutorials and information about Teradata.

rss_feed Subscribe RSS