<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www2.sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Kalen Delaney : GO</title><link>http://www2.sqlblog.com/blogs/kalen_delaney/archive/tags/GO/default.aspx</link><description>Tags: GO</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Geek City: Poor (Wo)Man's Load Testing</title><link>http://www2.sqlblog.com/blogs/kalen_delaney/archive/2007/10/24/geek-city-poor-womans-load-testing.aspx</link><pubDate>Wed, 24 Oct 2007 19:28:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:3082</guid><dc:creator>Kalen Delaney</dc:creator><slash:comments>5</slash:comments><comments>http://www2.sqlblog.com/blogs/kalen_delaney/comments/3082.aspx</comments><wfw:commentRss>http://www2.sqlblog.com/blogs/kalen_delaney/commentrss.aspx?PostID=3082</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last July, &lt;A title="Run a batch multiple times" href="http://sqlblog.com/blogs/kalen_delaney/archive/2007/07/22/did-you-know-run-a-batch-multiple-times.aspx"&gt;I posted about a way to run a batch multiple times&lt;/A&gt; when you use GO as the batch separator. I usually take advantage of this technique when I am loading test data into a table.&lt;/P&gt;
&lt;P&gt;I was mentioning this feature to my class last week in Minneapolis, and one of the students thought that this feature had another use. He thought it would be great to use it to simulate load testing. One connection could execute a procedure and terminate the batch with GO 100 and another connection could be started that did the same thing. You could open up multiple query windows using Management Studio (or Query Analyzer) and have each one run a procedure, or even a statement, over and over again. You could also have different connections run different stored procedures or statements. This will allow you to detect problems with concurrency, which most query tuning techniques do not take into account.&lt;/P&gt;
&lt;P&gt;In the past, I had recommended using the Replay feature of SQL Server Profiler to simulate a "poor man's load testing" environment, but this great idea would make it even easier!&lt;/P&gt;
&lt;P&gt;Of course, for the rich (wo)man, there is also very nice load testing software available. Whether rich or poor, it's crucial to make sure you test your queries and procedures with multiple users. &lt;/P&gt;
&lt;P&gt;Have fun!&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff00ff&gt;~Kalen&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www2.sqlblog.com/aggbug.aspx?PostID=3082" width="1" height="1"&gt;</description><category domain="http://www2.sqlblog.com/blogs/kalen_delaney/archive/tags/GO/default.aspx">GO</category><category domain="http://www2.sqlblog.com/blogs/kalen_delaney/archive/tags/testing/default.aspx">testing</category><category domain="http://www2.sqlblog.com/blogs/kalen_delaney/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Did You Know? Run a batch multiple times</title><link>http://www2.sqlblog.com/blogs/kalen_delaney/archive/2007/07/22/did-you-know-run-a-batch-multiple-times.aspx</link><pubDate>Sun, 22 Jul 2007 22:08:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:1880</guid><dc:creator>Kalen Delaney</dc:creator><slash:comments>12</slash:comments><comments>http://www2.sqlblog.com/blogs/kalen_delaney/comments/1880.aspx</comments><wfw:commentRss>http://www2.sqlblog.com/blogs/kalen_delaney/commentrss.aspx?PostID=1880</wfw:commentRss><description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At first I thought I would just add another sentence to my previous post, but then I realized that this feature is not even documented anywhere, and it might be useful to mention it in its very own post.&amp;nbsp; I have no idea why it is undocumented, but it has been part of all command interfaces to TSQL that I have used for the last 20 years.&lt;/P&gt;
&lt;P&gt;When you use GO as a batch terminator, you can follow it by an integer, which indicates that the batch should be executed N times. &lt;/P&gt;
&lt;P&gt;I use this frequently when populating test tables. In my &lt;A class="" href="http://sqlblog.com/blogs/kalen_delaney/archive/2007/07/22/did-you-know-forcing-a-nonclustered-index-scan-to-avoid-sorting.aspx"&gt;previous post&lt;/A&gt;, I ended with this suggestion:&lt;/P&gt;
&lt;P&gt;-- You can add more rows by just rerunning the INSERT statement from above, as many times as you would like. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, to run the INSERT 5 times, I would do this:&lt;/P&gt;
&lt;P&gt;INSERT INTO details &lt;BR&gt;(SalesOrderID, SalesOrderDetailID, CarrierTrackingNumber, OrderQty, ProductID, SpecialOfferID,&lt;BR&gt;UnitPrice, UnitPriceDiscount, rowguid, ModifiedDate) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT SalesOrderID, SalesOrderDetailID, CarrierTrackingNumber, OrderQty, ProductID, SpecialOfferID,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UnitPrice, UnitPriceDiscount, rowguid, ModifiedDate&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM Sales.SalesOrderDetail&lt;BR&gt;GO 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun!&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff00ff&gt;~Kalen&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www2.sqlblog.com/aggbug.aspx?PostID=1880" width="1" height="1"&gt;</description><category domain="http://www2.sqlblog.com/blogs/kalen_delaney/archive/tags/GO/default.aspx">GO</category><category domain="http://www2.sqlblog.com/blogs/kalen_delaney/archive/tags/Tools/default.aspx">Tools</category></item></channel></rss>