Sunday, October 23, 2011

GO 100000 - Learning something every day, today it's the SQL Server/TSQL GO Statement has a parameter...

Everyone has their favorite way or running a block of code over and over again. If you have to run an entire batch over and over again there is nothing as quick and easy as using the “GO n” syntax. When you put a number after the GO batch separator SQL Server Management Studio (as well as SQLCMD) will run that entire batch however many times that you have specified.

Recently I needed to create some dummy data in a table, so instead of writing a loop that counted the number of times the loop ran, I simply used code like this.


Read more: Greg's Cool [Insert Clever Name] of the Day
Read more: Quick and dirty way to run a batch over and over
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://itknowledgeexchange.techtarget.com/sql-server/quick-and-dirty-way-to-run-a-batch-over-and-over/

Posted via email from Jasper-Net