SUBSTRING Function Syntax | Teradata Vantage - 17.10 - SUBSTRING Function Syntax - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/djk1612415574830.ditamap
dita:ditavalPath
SQL_Functions__Expressions__and_Predicates.Upload_071421/wrg1590696035526.ditaval
dita:id
kby1472250656485

ANSI

SUBSTRING ( string_expression FROM n1 [ FOR n2 ] )

Syntax Elements

string_expression
A string expression from which the substring is to be extracted.
n1
The starting position of the substring to extract from string_expression.
The length of the substring to extract from string_expression.
If n1 < 0, the function returns an error.
n2
The length of the substring to extract from string_expression.
If n2 < 0, the function returns an error.
If you omit n2, then you extract the entire right hand portion of the named string or string expression, beginning at the position named by n1.
If string_expression is a BYTE or CHAR type and you omit n2, trailing binary zeros or pad characters are trimmed.

Teradata

{ SUBSTRING | SUBSTR } ( string_expression, n1 [, n2 ] )

Syntax Elements

string_expression
A string expression from which the substring is to be extracted.
n1
The starting position of the substring to extract from string_expression.
n2
The length of the substring to extract from string_expression.
If n2 < 0, the function returns an error.
If string_expression is a BYTE or CHAR type and you omit n2, trailing binary zeros or pad characters are trimmed.