REPLICATE Function [String]

Concatenates a string a specified number of times.

Syntax

REPLICATEstring-expression, integer-expression )

Parameters

Parameter

Description

string-expression

The string to be repeated.

integer-expression

The number of times the string is to be repeated.

Returns

LONG VARCHAR

LONG NVARCHAR

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

Example

The following statement returns the value “repeatrepeatrepeat:”

SELECT REPLICATE( 'repeat', 3 ) FROM iq_dummy

Usage

REPLICATE is the same as the REPEAT function.

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

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Compatible with Adaptive Server Enterprise.

Related reference
REPEAT Function [String]
REPLACE Function [String]