Duplicate a string multiple times.
| SELECT REPLICATE(‘SQL Tutorial’, 5); |
The REPLICATE() function duplicates a string a specified number of times.
| REPLICATE(string, integer) |
|
Parameter |
Description |
|
string |
Required: The string that will be duplicated multiple times. |
|
integer |
Required: Specifies how many times the string should be repeated. |
|
Works in: |
SQL Server (since 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |
Duplicate the text in CustomerName twice.
| SELECT REPLICATE(CustomerName, 2) FROM Customers; |