SUBSTR in Teradata

SUBSTR or SUBSTRING will work same in Teradata. The syntax may be different.

Syntax:
SUBSTR ( <column-name>, <start-location> [ , <length> ] )


Example:
SELECT
SUBSTR('Forget code', 4 , 3),
SUBSTR('Forget code', 1 , 6),
SUBSTR('Forget code', 8 , 4),
SUBSTR('Forget code', 4 , 8);

Output:
Substr('Forget code',4,3)Substr('Forget code',1,6)Substr('Forget code',8,4)Substr('Forget code',4,8)
getForgetcodeget code



The length is optional. When it is not included, all remaining characters to the end of the column are returned.

SELECT SUBSTR('Forget code', 4);

Output:
Substr('Forget code',4)
get code