There's More To GO Than Meets The Eye

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'

go 5

returns:

Beginning execution loop

hello world

hello world

hello world

hello world

hello world

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!).

     -wp