Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Selecting data from a stored procedure return set

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-07 : 11:28:08
Jeremy writes "Suppose I only have read-only access to a SQL Server 2000 database, therefore I can't modify or drop existing tables or stored procedures, nor can I create new ones.

Suppose there is a stored procedure "GetCityList" that returns a recordset like such:

State City
---------------------
WA Seattle
WA Tacoma
CA Los Angeles
CA Burbank
CA San Jose
CA San Diego
KS Kansas City
KS Topeka
KS Wichita

Now suppose that I want to call GetCityList (which has no parameters) but I only want part of this data, e.g., only the Cities in California.

Is there a way I can have the server run a SELECT statement against the result of the GetCityList sproc call, and then return the results of that to me as a recordset?

A pseudo-code prototype of what i'm getting at would be:
   select City from (exec GetCityList) where State = 'CA';

I've already got code (JScript via WSH) that executes the sproc and works with the resulting recordset... i just need a way to re-query or filter out certain things from it.

Any ideas?

Thanks in advance,

-jer"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-05-07 : 11:34:26
create temptable

insert into temptable
exec proc

select from temptable where criteria is met

Jay White
{0}
Go to Top of Page
   

- Advertisement -