String Functions – REPLICATE()

I am going to continue my series of very short articles or tidbits on Transaction SQL string functions. I will exploring the REPLICATE() function today. The REPLICATE() function takes a pattern string [S] and a integer replication count [C] as input. The function returns a string composed of pattern string [S] concatenated [C] times to itself as output. The example below replicates a pattern ‘XO’ five times.

One thing to always worry about when using TSQL functions is how will it react with a EMPTY strings or NULL…