Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

REPLICATE

Example

Duplicate a string multiple times.

SELECT REPLICATE(‘SQL Tutorial’5);

Definition and Usage

The REPLICATE() function duplicates a string a specified number of times.

Syntax

REPLICATE(string, integer)

Parameter Values

Parameter

Description

string

Required: The string that will be duplicated multiple times.

integer

Required: Specifies how many times the string should be repeated.

Technical Details

Works in:

 SQL Server (since 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse

More Examples

Example

Duplicate the text in CustomerName twice.

SELECT REPLICATE(CustomerName, 2)
FROM Customers;