Export (0) Print
Expand All

REPLICATE

SQL Server 2000

Repeats a character expression for a specified number of times.

Syntax
REPLICATE ( character_expression , integer_expression ) 
Arguments
character_expression
Is an alphanumeric expression of character data, or other data types that are implicitly convertible to nvarchar or ntext.
integer_expression
Is an expression that can be implicitly converted to int. If integer_expression is negative, a null string is returned.
Return Types

nvarchar or ntext

Examples

The following example replicates (twice) the last name of each employee in the Employee table in the Northwind database.

SELECT REPLICATE (LastName, 2) AS "LastName Twice"
FROM Employees

This is the result set:

LastName Twice
--------------
FullerFuller
PeacockPeacock
CallahanCallahan
DavolioDavolio
LeverlingLeverling
BuchananBuchanan
SuyamaSuyama
KingKing
DodsworthDodsworth

Show:
© 2015 Microsoft