I was recently trying to create some large strings containing generic test data for a question here. It seems that I used to know of a way to multiply a string. However, I can no longer remember the syntax.
I'm looking for something like:
SELECT 'A' + ('a' * 1000) + 'ha!'
To come up with "Aaaaaaaaaaaaaaaha!" (Well, much longer, of course.)
Is this possible in T-SQL? (Or am I thinking of some other language?) Also, are there any other techniques to generate large strings?
REPLICATEtoo, depending on how Richard will use it (e.g. it can behave differently when using length of varchar vs. char), which is why I hot-linked theREPLICATEkeyword to point to the documentation, instead of trying to regurgitate all of the potential gotchas from the documentation here. – Aaron Bertrand Aug 18 '11 at 14:38