17.10 - Example: STRIP_EXTERIOR_SPACES and STRIP_ENCLOSING_CHAR - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

This example shows a CSV table, csv_tab_2, and the effect of STRIP_EXTERIOR_SPACES and STRIP_ENCLOSING_CHAR on it. The asterisk (*) represents a single space character.

Select from csv_tab_2

SELECT a,b,c,d FROM csv_tab_2;
a,b,c,d
" $1.11"," $2,000 ",*$511*,*888
" $2.22"*,*" $6,000",*"$911"*,*"444”

STRIP_EXTERIOR_SPACES ('FALSE'), STRIP_ENCLOSING_CHAR ('NONE') (Default)

a  " $1.11"
b  " $2,000 "
c  *$511*
d  *888
a  " $2.22"*
b  *" $6,000"
c  *"$911"*
d  *"444"

STRIP_EXTERIOR_SPACES ('TRUE'), STRIP_ENCLOSING_CHAR ('NONE')

a  " $1.11"
b  " $2,000 "
c  $511
d  888
a  " $2.22"
b  " $6,000"
c  "$911"
d  "444"

STRIP_EXTERIOR_SPACES ('FALSE'), STRIP_ENCLOSING_CHAR ('"')

a  *$1.11
b  *$2,000*
c  *$511*
d  *888
a  " $2.22"*
b  *" $6,000"
c  *"$911"*
d  *"444"

STRIP_EXTERIOR_SPACES ('TRUE'), STRIP_ENCLOSING_CHAR ('"')

a *$1.11
b *$2,000*
c *$511*
d *888
a *$2.22
b *$6,000
c $911
d 444