Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
Simple text functions
How to modify Strings
25. The REPLICATE() function
Summary

Instruction

Fantastic!

The last function in this section is REPLICATE(). It repeats a string (given in the first parameter) the number of times specified by the second parameter. Here is an example:

SELECT
  REPLICATE(N'.',3) + Name
FROM Item;

This query returns the item name with three periods in front of it.

a16

Let's try this out!

Exercise

Slogans with multiple star and dot characters (e.g., SLOGAN *.*.*.*.*.) are fashionable this season. The marketing agency management has decided to change all slogans' texts to include a space and a string of five stars and five dots at the end. Show slogan texts with trailing space, stars and dots. Name the column FashionableText.

Stuck? Here's a hint!

Use Text + ' ' + REPLICATE('*.',5) expression.