Type: Scalar function

This function truncates a string if necessary to make it fit within the supplied max length.

If truncation occurs then this is indicated by a having the specified indicator string appended to to the end of the truncated string. The truncation is performed such that the final string, including the truncation indicator, fits withing the specified max length.

The default truncation indicator is the ellipsis character ('…').

Return value: nvarchar(max)

The processed string.


@String mandatory nvarchar(max)
The string to process.
@MaxLength mandatory int
The length that the processed string may not exceed.
@Indicator mandatory nvarchar(100)
The string to use as truncation indicator. Set to DEFAULT to use the ellipsis character ('…').