While working on SQL Server we all encounter GO statement quite often. Till today GO statement for me was just an indication sent out to SQL Server utilities about end of a batch of Transact - SQL.
Today while going through MSDN I found a new (surprising) thing about GO. Go can actually take an integer argument. Yes! it is true. Go takes an optional integer argument. Something like this,
As per MSDN,
count is a positive integer. The batch preceding GO will execute the specified number of times.
What this means is, suppose you have a script like the one below,
Here, INSERT statement will be executed 5000 times and you will end up inserting 5000 records in table.
Currently Listening to: In the summer time - SHAGGY