This little tidbit originated with Kalen Delaney, and was forwarded to me by Lance Larsen, a colleague here at Microsoft. I've verified that this works in all versions of SQL Server since SQL Server 2000 SP4.
Here's Lance's note:
I did not know about this feature until yesterday…could make inserting test data easier.
PRINT 'hello world'
Beginning execution loop
Batch execution completed 5 times.
Pretty slick, eh?
I hope this tip comes in handy; thanks to Lance for passing it along (and to Kalen for finding it!).
My initial thought was what a brilliant but useless tidbit. But then again when I started really thinking about how useful this might be - for soak testing for example.
Exactly, Greg.. most of these techniques can strike one as highly esoteric, until one needs them. :-)