Kbase P110746: How to connect or concatenate two character fields without having too many spaces in the output form
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/2/2006 |
|
Status: Unverified
GOAL:
How to connect or concatenate two character fields without having too many spaces in the output format of the result?
GOAL:
How to connect two character columns with a single space between them?
Yields the undesired result:
Burlington- USA
GOAL:
How to concatenate two fields and and a space character between then have the result formatted as "Field1 Field2" and not "Field1 Field2"?
FIX:
Use one of the following ways to connect two character columns with one or more characters without having too many extra spaces output between the fields:
1. Use the concatenation operator '||':
SELECT City || '-' || Country FROM PUB.Customer
2. Use the ASCII code of the character involved:
SELECT City + CHR(45) + Country FROM PUB.Customer;
3. Use parenthesis to group the connecting character with the second field:
SELECT City + ( '-' + Country) FROM PUB.Customer;
4. Use the CONCAT Function:
SELECT CONCAT(CONCAT(City, '-'),Country) FROM PUB.Customer