The REPEAT function returns a string repeated a specified number of times in database systems that support the function.
Repeated characters can be useful when generating separators, formatting output, or creating test data.
Generate a line made up of repeated hyphens.
SELECT
REPEAT('-', 20) AS Separator;
REPEAT can be useful for report formatting, test data generation, text templates, and output preparation.
- REPEAT duplicates a string.
- The repetition count is specified.
- It is useful for formatting.
- It can help create test data.
- Function availability varies by database.
What does REPEAT do?
REPEAT returns a string multiple times according to the specified repetition count.
Where can REPEAT be useful?
It can be useful for report separators, formatted output, and generating test data.