SQL SERVER – Repeate String N Times Using String Function REPLICATE

I came across this SQL String Function few days ago while searching for Database Replication. This is T-SQL Function and it repeats the string/character expression N number of times specified in the function.

SELECT REPLICATE( ' https://blog.sqlauthority.com/ ' , 9 )

This repeats the string https://blog.sqlauthority.com/ to 9 times in result window. I think it is fun utility to generate repeated text if ever required.

Result Set:
https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/ https://blog.sqlauthority.com/

(1 row(s) affected)

Reference : Pinal Dave (https://blog.sqlauthority.com/) , BOL

SQL Function, SQL Scripts, SQL String
Previous Post
SQLAuthority News – Book Review – Microsoft(R) SQL Server 2005 Unleashed (Paperback)
Next Post
SQL SERVER – Explanation and Example Four Part Name

Related Posts

Leave a Reply