﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Jon Winer / Article Discussions / Article Discussions by Author  / More on Returning a Subset of a Recordset / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 19:40:52 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: More on Returning a Subset of a Recordset</title><link>http://www.sqlservercentral.com/Forums/Topic1139-30-1.aspx</link><description>&lt;P&gt;what happens when the field you order by on&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;is null&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;for many records&lt;/P&gt;&lt;P&gt;for example :&lt;/P&gt;&lt;P&gt;select top 10 custnum,custname from customers where &lt;STRONG&gt;custname &amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(select max&lt;STRONG&gt;(custname)&lt;/STRONG&gt;  from customers ) A order by &lt;STRONG&gt;custname&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;when you got many records where custname = null&lt;/P&gt;&lt;P&gt;then the result is null&lt;/P&gt;&lt;P&gt;resolve that please&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 19 Jul 2005 08:03:00 GMT</pubDate><dc:creator>ilan rosen</dc:creator></item><item><title>RE: More on Returning a Subset of a Recordset</title><link>http://www.sqlservercentral.com/Forums/Topic1139-30-1.aspx</link><description>Thanks for your feedback.  Your approach is definitely a solid option.  Many ways to skin a cat. </description><pubDate>Wed, 19 Dec 2001 17:36:00 GMT</pubDate><dc:creator>jwiner</dc:creator></item><item><title>RE: More on Returning a Subset of a Recordset</title><link>http://www.sqlservercentral.com/Forums/Topic1139-30-1.aspx</link><description>lol - ok, nicely done.  Somewhat more efficient than cursors :)Why don't you just build a table and then use a between?  The following example is in T-SQL as it allows the handy table var (automatically cleared after sp exec)CREATE PROCEDURE getSubset (@start int, @end int) ASDECLARE @tblTemp TABLE (pID int,			intData int,			strData nvarchar(50))INSERT INTO @tblTempSELECT /*insert main functionality of sp here*/SELECT	 *FROM	 @tblTempWHERE	 pID between		@start and		@endORDER BY intDataLife's not difficult...enjoy it.Nood!e</description><pubDate>Wed, 19 Dec 2001 05:16:00 GMT</pubDate><dc:creator>MagneticNoodle</dc:creator></item><item><title>More on Returning a Subset of a Recordset</title><link>http://www.sqlservercentral.com/Forums/Topic1139-30-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/jwiner/moreonreturningasubsetofarecordset.asp&gt;http://www.sqlservercentral.com/columnists/jwiner/moreonreturningasubsetofarecordset.asp&lt;/A&gt;</description><pubDate>Wed, 26 Sep 2001 00:00:00 GMT</pubDate><dc:creator>jwiner</dc:creator></item></channel></rss>