CONCAT

Syntax

CONCAT {src_any_lit|_var|_col} WITH  dst_txt_var[[:$]edit_mask]

Description

Concatenates a variable, column, or literal with a string variable.

The contents of the source field are appended to the end of the destination field.

CONCAT can optionally edit the source field before appending it. You can change edit masks dynamically by placing them in a string variable and referencing the variable name preceded by a colon (:).

Also, the source can be a date variable or column. If an edit mask is not specified, the date is converted to a string according to the following rules:

  • For DATETIME columns and SQR DATE variables, SQR uses the format specified by the SQR_DB_DATE_FORMAT setting.

    If this has not been set, the first database-dependent format listed in the Default Database Formats table is used.

  • For DATE columns, SQR uses the format specified by the SQR_DB_DATE_ONLY_FORMAT.

    If a format has not been set, the format listed in the Default Database Formats table is used.

  • For TIME columns, SQR uses the format specified by the SQR_DB_TIME_ONLY_FORMAT.

    If a format has not been set, the format listed in the Time Column Formats table is used.

Parameters

Parameter Description

src_any_lit|_var|_col

Specifies the source field to be concatenated with the dst_txt_var field.

dst_txt_var

Contains the result after execution

edit_mask

Specifies an optional edit mask.

Example

The following example illustrates the CONCAT command:

concat &zip_plus_4 with $zip '-xxxx'        ! Edit zip plus 4.
concat &descrip with $rec :$desc_edit       ! Edit mask in variable.
concat $date1 with $string                  ! Concatenate a date.

See The PRINT command for information about the Default Database Formats table, the Time Column Formats table, and edit masks

See The LET command for string functions

See STRING, UNSTRING