Wednesday, May 08, 2013

Go can be more than just a GO (in the T-SQL world at least) - GO [#]

CodeProject - GO Statement can also be used to excute batch of T-SQL statement multiple times

Till recently, I was under the impression that GO statement’s sole purpose is to convey to the SQL Server the end of a batch of T-SQL Statements. But recently while searching for some SQL feature details, I landed on to the MSDN page for the GO statement. And to my surprise, I observed that GO statement also has an integer optional parameter, this parameter value signals SQL Server to execute the batch of T-SQL Statement prior to the GO statement to be executed for the specified number of times.



I always forget about this feature of the T-SQL GO statement...

No comments: