4. Elements of OpenSQL Statements : Functions : Scalar Functions : String Concatenation Results
 
Share this page                  
String Concatenation Results
The following table shows the results of concatenating expressions of various character data types:
1st String
2nd String
Trim Blanks
 
Result Type
from 1st?
from 2nd?
c
c
Yes
--
c
c
text
Yes
--
c
c
char
Yes
--
c
c
varchar
Yes
--
c
c
long varchar
Yes
No
long varchar
text
c
No
--
c
char
c
Yes
--
c
varchar
c
No
--
c
long varchar
c
No
No
long varchar
text
text
No
No
text
text
char
No
Yes
text
text
varchar
No
No
text
text
long varchar
No
No
long varchar
char
text
Yes
No
text
varchar
text
No
No
text
long varchar
text
No
No
long varchar
char
char
No
--
char
char
varchar
No
--
char
char
long varchar
No
No
long varchar
varchar
char
No
--
char
long varchar
char
No
No
long varchar
varchar
varchar
No
No
varchar
long varchar
long varchar
No
No
long varchar
When concatenating more than two operands, expressions are evaluated from left to right. For example:
varchar + char + varchar
is evaluated as:
(varchar+char)+varchar
To control concatenation results for strings with trailing blanks, use the trim, notrim, and pad functions.