STRING Function [String]

Concatenates one or more strings into one large string.

Syntax

STRINGstring-expression [ , … ] )

Parameters

Parameter

Description

string-expression

A string. If only one argument is supplied, it is converted into a single expression. If more than one argument is supplied, they are concatenated into a single string. A NULL is treated as an empty string ('').

Returns

LONG VARCHAR

LONG NVARCHAR

LONG BINARY

Note: The result data type is a LONG VARCHAR. If you use STRING in a SELECT INTO statement, you must have an Unstructured Data Analytics Option license or use CAST and set STRING to the correct data type and size.

Example

The following statement returns the value testing123:

SELECT STRING( 'testing', NULL, 123 )
FROM iq_dummy

Usage

Numeric or date parameters are converted to strings before concatenation. You can also use the STRING function to convert any single expression to a string by supplying that expression as the only parameter.

If all parameters are NULL, STRING returns NULL.

Standards and Compatibility

  • SQL—Transact-SQL extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.