Substring - Teradata Warehouse Miner

Teradata® Warehouse Miner™ User Guide - Volume 2ADS Generation

Product
Teradata Warehouse Miner
Release Number
5.4.6
Published
November 2018
Language
English (United States)
Last Update
2018-12-07
dita:mapPath
gxn1538171534877.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-2301
Product Category
Software

The standard Substring function is supported for extracting a portion of a string based on a position value and optional length. The SQL generated is SUBSTRING (expression FROM position FOR length). The expression to take a substring from may be of a character, numeric or date type, with a numeric or date expression being automatically converted to a character expression before taking the substring. The first position in the string is 1, and if length is set equal to 0 it means “until the end of the string”. The type returned is VARCHAR. When dragging a Substring operator into a variable, the following tree element is created.

Variable Creation > Input > Variables: SQL Elements pane - String Functions > Substring

Columns and/or other expressions can be moved into the (empty) branch of the tree. The starting position and length of the substring are specified in the Properties panel. Double-click on Substring, or highlight it and click Properties.

If it is necessary to use an expression for the starting position or length of the substring, consider using the SQL Text with Arguments element in the Other category and specify the text as SUBSTRING(<P1> FROM <P2> FOR <P3>), where the first argument is the expression to take a substring from and the second and third arguments are numeric expressions representing the starting position and length of the substring, respectively.