Previous Topic

Next Topic

SQL String Operators

Use string operators to perform string concatenation on character data in SELECT queries. The following outlines the string operator supported by the SQL engine.

Operator

Description

||

Concatenation

String operations can be performed wherever non-aggregated data values are allowed, such as in a SELECT or WHERE clause. In following example, a field value concatenated with a second field value to provide a new calculated field in the query result set:

  SELECT (LastName || ', ' || FirstName) As FullName from APCONTCT

String operators operate only on string values or memo fields.

Note: Concatenating with a null string will return null. To treat null strings as empty coalesce with an empty string.

e.g.

Select CustomerCode

,Cast(Coalesce(Address1, '') || ' ' || Coalesce(Address2, '') || ' ' || Coalesce(Address3, '') || ' ' || Coalesce(Address4, '') as VarChar(120)) as Address

From ARCUST

Where CustomerCode = 'ASHENG'

See Also

SQL Operators

Book Contents

Book Index