INSERTSTR Function [String]

Inserts a string into another string at a specified position.

Syntax

INSERTSTRnumeric-expression, string-expression1, string-expression2 )

Parameters

Parameters

Parameter

Definition

numeric-expression

The position after which string-expression2 is to be inserted. Use zero to insert a string at the beginning.

string-expression1

The string into which string-expression2 is to be inserted.

string-expression2

The string to be inserted.

Returns

LONG VARCHAR

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

Example

The following statement returns the value “backoffice”:

SELECT INSERTSTR( 0, 'office ', 'back' ) FROM iq_dummy

Standards and Compatibility

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

  • Sybase—Not supported in Adaptive Server Enterprise. The STUFF function is equivalent and is supported in both Adaptive Server Enterprise and Sybase IQ.