Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #699

Re: Trying to understand 400 line stored procedure

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Trying to understand 400 line stored procedure
Date Sun, 02 Oct 2011 14:29:50 +0200
Organization Erland Sommarskog
Lines 34
Message-ID <Xns9F72937972F25Yazorman@127.0.0.1> (permalink)
References <e69f875eoqplodjkvto1tcghs6rlf9beu0@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Info mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="5278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/VzN5rCIgLUPVd8GVk118C"
User-Agent Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32)
Cancel-Lock sha1:7IpKVpB1CgaUm6TcHt4mgR4f95Q=
Xref x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:699

Show key headers only | View raw


Tony C. (me@here.com) writes:
> The reader populates fields by incrementing an integer index for each
> field in a row not by table tnames
> 
> The read uses nextresult() to move to the next restult set....
> 
> My Question is: Is the order of the resultsets in the Reader the same
> as the order of Select statements in the stored procedure? I suppose
> I should have a result set for every select statement?
 
Yes, the result sets are returned in the reader, in the order they are 
produced in SQL Server. Note that it is the run-time order that matters.
That is, if the code goes:

  CREATE PROCEDURE baaaaad_sp AS
  GOTO bottom
  top: SELECT 989 AS xyz
       RETURN
  bottom: SELECT getdate() AS now
          GOTO top

The first result set will be the date, and the second result set will the 
number.
  



-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Trying to understand 400 line stored procedure Tony C. <me@here.com> - 2011-10-01 18:48 -0500
  Re: Trying to understand 400 line stored procedure Erland Sommarskog <esquel@sommarskog.se> - 2011-10-02 14:29 +0200
    Re: Trying to understand 400 line stored procedure Tony C. <me@here.com> - 2011-10-02 08:29 -0500

csiph-web