replicate

Description

Returns a string consisting of the specified expression repeated a given number of times, or as many as can fit into a 16KB space, whichever is less.

Syntax

replicate(char_expr | uchar_expr, integer_expr)

Parameters

char_expr

is a character-type column name, variable, or constant expression of char, varchar, nchar, or nvarchar type.

uchar_expr

is a character-type column name, variable, or constant expression of unichar or univarchar type.

integer_expr

is any integer (tinyint, smallint, or int) column name, variable, or constant expression.

Examples

Example 1

select replicate("abcd", 3)
------------ 
abcdabcdabcd

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute replicate.

See also

Documentation Transact-SQL Users Guide

Function stuff