bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL Server REPLICATE() Function

Concept visual

SQL Server REPLICATE() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Repeat a string:

SELECT REPLICATE('SQL Tutorial', 5);

Definition and Usage

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

Syntax

Replicate(

string, integer )

Parameter Values

Parameter

Description string

Required. The string to repeat integer Required. The number of times to repeat the string

Technical Details

Works in:

SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

More Examples

Example

Repeat the text in CustomerName two times: SELECT REPLICATE(CustomerName, 2)

FROM Customers;

Previous

❮ SQL Server Functions

Next

Previous

SQL Server REPLACE() Function

Next

SQL Server REVERSE() Function