devxlogo

Using REPLICATE for SQL Strings

Using REPLICATE for SQL Strings

The following example replicates a # character five times in front of a Student Number in the Students table:

SELECT [Student Name], REPLICATE('#', 5) + [Student Number] AS 'Student Number'FROM [Students]GOHere is an example result set.Student Name Student NumberTest Name 1 - #####STU1Test Name 2 - #####STU2Test Name 3 - #####STU3Test Name 4 - #####STU4Test Name 5 - #####STU5
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist