<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: T-SQL &#8211; Using a parameter in SELECT TOP clause</title>
	<atom:link href="http://cowburn.info/2007/03/15/select-top-parameter/feed/" rel="self" type="application/rss+xml" />
	<link>http://cowburn.info/2007/03/15/select-top-parameter/</link>
	<description>Online storage depot for Peter Cowburn</description>
	<lastBuildDate>Wed, 28 Jul 2010 07:05:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Dao T</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-60098</link>
		<dc:creator>Dao T</dc:creator>
		<pubDate>Wed, 28 Jul 2010 07:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-60098</guid>
		<description>Thanks alot, That great tip saved me lots of time !!!</description>
		<content:encoded><![CDATA[<p>Thanks alot, That great tip saved me lots of time !!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BruceS</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-58755</link>
		<dc:creator>BruceS</dc:creator>
		<pubDate>Mon, 15 Feb 2010 05:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-58755</guid>
		<description>Many thanks.  I have been looking around for this answer.</description>
		<content:encoded><![CDATA[<p>Many thanks.  I have been looking around for this answer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petulka77</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-58192</link>
		<dc:creator>Petulka77</dc:creator>
		<pubDate>Wed, 06 Jan 2010 01:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-58192</guid>
		<description>Thnks! That is what I am looking for!</description>
		<content:encoded><![CDATA[<p>Thnks! That is what I am looking for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dean</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-55628</link>
		<dc:creator>Dean</dc:creator>
		<pubDate>Tue, 28 Jul 2009 20:36:58 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-55628</guid>
		<description>Thanks for the tip, it works great.  I&#039;m using SQL Server 2008 and I am not noticing any performance issues.</description>
		<content:encoded><![CDATA[<p>Thanks for the tip, it works great.  I&#8217;m using SQL Server 2008 and I am not noticing any performance issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EK</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-55372</link>
		<dc:creator>EK</dc:creator>
		<pubDate>Thu, 16 Jul 2009 10:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-55372</guid>
		<description>Thanks for writing this had a series of if statements otherwise, ta</description>
		<content:encoded><![CDATA[<p>Thanks for writing this had a series of if statements otherwise, ta</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-52771</link>
		<dc:creator>Vladimir</dc:creator>
		<pubDate>Wed, 06 May 2009 09:40:40 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-52771</guid>
		<description>Its what i have had problems with as well. Quick &amp; clear solution! Thanks!</description>
		<content:encoded><![CDATA[<p>Its what i have had problems with as well. Quick &amp; clear solution! Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CLINKS</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-32701</link>
		<dc:creator>CLINKS</dc:creator>
		<pubDate>Tue, 20 Jan 2009 22:50:37 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-32701</guid>
		<description>Thanks! Save me a lot of time as well!</description>
		<content:encoded><![CDATA[<p>Thanks! Save me a lot of time as well!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andell</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-23702</link>
		<dc:creator>Andell</dc:creator>
		<pubDate>Sun, 27 Apr 2008 11:47:04 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-23702</guid>
		<description>SELECT Top (@Variable)  ... , actially works on SQL2005</description>
		<content:encoded><![CDATA[<p>SELECT Top (@Variable)  &#8230; , actially works on SQL2005</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-23264</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 02 Apr 2008 07:08:20 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-23264</guid>
		<description>This had me really excited, until I tried it. I concur with what the last poster wrote. I used this trick to query a table in SQL Server 2005 and my query went from less than a second with a hardcoded value for TOP, to 26 seconds (!!) using the same value in a parameterized TOP. Boo!</description>
		<content:encoded><![CDATA[<p>This had me really excited, until I tried it. I concur with what the last poster wrote. I used this trick to query a table in SQL Server 2005 and my query went from less than a second with a hardcoded value for TOP, to 26 seconds (!!) using the same value in a parameterized TOP. Boo!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ofer Presente</title>
		<link>http://cowburn.info/2007/03/15/select-top-parameter/#comment-18122</link>
		<dc:creator>Ofer Presente</dc:creator>
		<pubDate>Sun, 13 Jan 2008 13:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://cowburn.info/web-coding/select-top-parameter/#comment-18122</guid>
		<description>The parameterized top does work (only in 2005 as was stated here), but it can be very slow sometimes. I wrote a query that uses

set @Limit=40
select top (@Limit) .....

This query takes 15 seconds. When the very same query is changed to 
select top (40) ....

it takes 3 seconds - 1/5 of the duration of the parameterized top!!!</description>
		<content:encoded><![CDATA[<p>The parameterized top does work (only in 2005 as was stated here), but it can be very slow sometimes. I wrote a query that uses</p>
<p>set @Limit=40<br />
select top (@Limit) &#8230;..</p>
<p>This query takes 15 seconds. When the very same query is changed to<br />
select top (40) &#8230;.</p>
<p>it takes 3 seconds &#8211; 1/5 of the duration of the parameterized top!!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
