Is it possible to have a stored procedure with many queries give you a record set beyond the first query WITHOUT creating a temporary table?<BR><BR>Any good links or pointers on this subject appreciated.
...and you should really ask this in Databases forum.<BR><BR>But...<BR><BR>I *think* the answer is yes. You can actually create a "table type" in SQL Server which is just an in-memory pseudo-table. That can hold the results of your query.<BR><BR>Look here:<BR>http://msdn.microsoft.com/library/en-us/tsqlref/ts_ta-tz_7ysl.asp<BR><BR>It even says that the primary purpose of this format (a table as a local variable) is "for temporary storage of a set of rows, which are to be returned as the result set of a table-valued function."<BR><BR>
First of all, I have this page bookmarked:<BR><BR>http://msdn.microsoft.com/library/en-us/tsqlref/ts_syntaxc_9kvn.asp<BR><BR>And then I know from experience that I can use the left panel of that page to scroll around and look for things (mostly alphabetically).<BR><BR>In this case, since I remembered that you needed to set a local variable to some kind of table type, I scrolled down to "Data Types" and clicked on that.<BR><BR>Then I scrolled down on that page and found "table" as a data type. Clicked on it.<BR><BR>Presto.<BR><BR>From that starting bookmark, I can find most things in TSQL within a few clicks.<BR><BR>
what I have is an html page that has all my book marks on it. This way, no matter what computer I am on I have my bookmarks. I will add this to it in my SQL section. Probably at the top....<BR><BR>thanks