Pages

Friday, August 9, 2013

Replicate function in SQL server


Replicate functions is used to replicate the string of given no. of times, it takes 2 arguments, first argument takes string and second argument is an integer defines no. of times to replicate string.

REPLICATE(arg1,arg2)

arg1=> string to repeat (ex. 'ankit')
arg2=> no. of times to repeat (ex. 5)

Query: 

SELECT REPLICATE('ankit',5)


output will be: ankitankitankitankitankit

No comments:

Post a Comment