STRING

Syntax

STRING {src_any_lit|_var|_col}...BY {delim_txt_lit|_var|_col} INTO dst_txt_var

Description

Concatenates a list of variables, columns, or literals into a single text variable. Each member of the list is separated by the specified delimiter string.

The destination string must not be included in the list of source strings.

Parameters

Parameter Description

{src_any_lit|_var|_col}

Specifies one or more fields to be concatenated, separated by the delim_txt_lit|_var|_col character or characters, and placed into the dst_txt_var variable.

If the source is a date variable or column, it 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, SQR uses the first database-dependent format as listed in the Default Database Formats table.

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

If this has not been set, SQR uses the format listed in the Default Database Formats table.

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

If this has not been set, SQR uses the format as listed in the TIME Column Formats table.

{delim_txt_lit|_var|_col}

Specifies one or more characters to be used as separator characters between the source fields.

dst_txt_var

Specifies the destination field for the concatenated result.

Example

The following example shows the STRING command:

string  &name  &city  &state  &zip  by  ' - '  into  $show-info
                  ! Result:  Sam Mann - New York - NY - 11287
string  &cust_num  &entry-date  &total  by  ','  into  $cust-data
                  ! Result:  100014,12-MAR-04,127
                  ! Use null delimiter.
string  &code1  &code2  &code3  by  ''  into  $codes123
                  ! Result:  AGL

See The UNSTRING command for additional information

See The "||" concatenation operator in the Operators table under the LET command