YAKOVM
YAKOVM

Reputation: 10163

build dynamic string efficiently tsql

I need to build a string in tsql which is a repetition of a given char for example if I have inputs

@in char,@len int

and in = 'x' ,len = 7 the result will be

xxxxxxx

Upvotes: 0

Views: 29

Answers (1)

shree.pat18
shree.pat18

Reputation: 21757

Try this:

select replicate(@in,@len)

Upvotes: 2

Related Questions